问题:回显有时不成功有时成功,成功时会发送多发送市和区的请求,请求时间长的时候没有回显成功的几率较大
clearable
size="medium"
v-model="formData.arealist"
:props="areaPropsTwo"
placeholder="请选择省/市/区"
:disabled="isForbidden"
>
获取地址数据,这里是三个请求
areaPropsTwo: {
lazy: true,
lazyLoad (node, resolve) {
const level = node.level
if (level === 0) {
getProvince().then(res => {
const { status, data, message } = res
if (status === 1) {
const nodes = data.map(item => {
return {
value: item.code,
label: item.name
}
})
resolve(nodes)
} else {
this.$message.error(message)
}
})
} else if (level === 1) {
const selectData = node.data.value
getCitys({provinceCode: selectData}).then(res => {
const { status, data, message } = res
if (status === 1) {
const nodes = data.map(item => {
return {
value: item.code,
label: item.name
}
})
resolve(nodes)
} else {
this.$message.error(message)
}
})
} else if (level === 2) {
const selectData = node.data.value
getCounty({cityCode: selectData}).then(res => {
const { status, data, message } = res
if (status === 1) {
const nodes = data.map(item => {
return {
value: item.code,
label: item.name,
leaf: level >= 2
}
})
resolve(nodes)
} else {
this.$message.error(message)
}
})
}
}
}
};
回显的时是直接赋值的地区编码值 ,格式是 ["410000", "410100", "410105"]
this.formData.arealist = [
resData.merProvince,
resData.merCity,
resData.merDistrict
];