let myData = [
{id:1,name:"",age:10,Career:null},
{id:2,name:"",age:10,Career:""},
{id:3,name:"",age:10,Career:null},
];
to replace an empty Career with a string--
my way is
Nullzhuan(data){
if(data == null){
return "- -";
}else{
return data;
}
}
let _this = this;
myData.map(item=>{
item.name = _this.Nullzhuan(item.name);
item.age= _this.Nullzhuan(item.age);
item.Career = _this.Nullzhuan(item.Career);
})
I think mine is too troublesome. Is there any easier way?