出现这种情况可以是加载顺序的问题,加载没有完成就是显示数据了
试试 async和await
async beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
await getDetail(this.form.id).then((res) => {
this.form = res.data.data;
console.log(this.form);
this.form.chargingPeriodSetting = this.form.voList;
console.log(this.form.chargingPeriodSetting)
});
}
done();
},
改成这种就行了