this.dict.type.mq_type是从字典里获取的,直接调用changeSourceType(),由于this.dict.type.mq_type也是字典从接口获取的,this.dict.type.mq_type.forEach会报错,请问这种异步该怎么处理呢?
changeSourceType() {
let label = null
this.filterDataSourceList = []
this.dict.type.mq_type.forEach((item) => {
if (item.value == this.form.src__type) {
label = item.label
}
})
this.dataSourceList.forEach((item) => {
if (item.baseType == label) {
this.filterDataList.push(item)
}
})
},
既然你的 changeSourceType 方法中存在依赖于字典接口返回值的数据,那么不就要直接调用这个方法: