1.0 默认的数据状态
// pages/user/user.js const App = getApp(); Page({ /** * 页面的初始数据 */ data: { stateNav:[ { isShow:false, count:'', icon:'iconshenqing_on', title:'申请中', status:6 }, { isShow: false, count: '', icon: 'iconshenqingshibai', title: '申请失败', status: 5 },
]
}
2.0 设置改变数组对象的其中的值
//改变isShow字段
that.data.stateNav.forEach((item, index) => { let stateNavIdx = "stateNav[" + index + "].isShow";
if (re.data[index + 1] != 0) {
that.setData({
[stateNavIdx]: true
});
}
});