el-cascader懒加载
<el-form-item label="地址:" class="form-item">
<el-cascader v-model="form.areaId" :props="props"></el-cascader>
</el-form-item>
export default {
data(){
return{
props: {
lazy: true,
checkStrictly: true,
emitPath: false,
lazyLoad(node, resolve) {
const { level } = node
let datas = []
setTimeout(() => {
let code = -1
if (level != 0) {
code = node.data.value
}
ARAE_CHILD(code).then((response) => {
if (response.data.data && response.data.data.length) {
datas = response.data.data.map((value, i) => ({
value: value.areaId,
label: value.areaName,
leaf: level >= 4
}))
} else {
datas = []
}
resolve(datas)
})
}, 200)
}
},
}
}
}