topic description
I have a city cascade selection function here, but when I use el-cascader, I find that it is very troublesome to deal with loading data on demand, and the government does not provide a brief introduction. I did not find a satisfactory solution for the problems related to searching on the Internet page. I do not know if you have a concise method.
related codes
</span>
<br> <br> <br> ...
:
[
{
id: 1,
pid: 2,
name: "",
index: 0,
children: [{
id: 11,
pid: 21,
name: "",
index: 0,
children: [{
id: 111,
pid: 211,
name: "/",
index: 0,
children: [{}]
}]
}]
}
]
here comes the problem
when you click [Tianjin], the change method can only get the index:0, update children of Tianjin: this.list_ linkage[ Val]. Children = res.body.data
when you click [Heping Zone], the change method can only get the index:0, update children of Heping District: this.list_ Linkageval []. Childrenval]. Children = res.body.data
in turn, the back-end data is easy to obtain, but the foreground data cannot be processed. Because the parameter in the change return method is the value corresponding to the value defined in props, it is not the current row data, so there is no way to deal with it.
expected results
do you have a better way to deal with a lot of data and use el-cascader gracefully?
this is not borrowlism either. I"d like to discuss with you how el-cascader handles multiple data loading on demand.