呈现的画面是,明明属性加进入有时候显示有时候不显示
解决方法的:array是从后台获取的数组,
data: { list:[], classifyList:[],//这是从后台获取的键值对数组 }, getList(){ var array=result.rows; array.map((item,index)=>{ var caseSourceName=this.getFileItem(item.caseSource,this.data.classifyList) //获取对应的label值 var li = "list[" + index + "].caseSourceName";//这是关键,把数组中caseSourceName中改变 that.setData({ list:array, [li]:caseSourceName //这是关键,把data中list中相应的属性改变 }) }) },
getFileItem(vaule,arys){//根据value值获得label值 let fileAry=arys; for(var i=0,n=fileAry.length;i<n;i++){ if(Number(fileAry[i].dictValue)==Number(vaule)){ return fileAry[i].dictLabel; } } },
var array=result.rows;array.map((item,index)=>{ var caseSourceName=this.getFileItem(item.caseSource,this.data.classifyList) var li = "list[" + index + "].caseSourceName";//这是关键 that.setData({ list:array, [li]:caseSourceName }) })