本文共 453 字,大约阅读时间需要 1 分钟。
在后台返回的数组里面的字段与element默认的不相同时,element开发文档有个属性:children,子选项是可以修改的
children 指定选项的子选项为选项对象的某个属性值 string — ‘children’
//element级联选择器的组件//初始化data() { return { selectedOptions: [], options: [], defaultParams: { label: 'name', //名字赋值给label value: 'id', children: 'districtChildren' //将后端返回的子选项字段赋值给element默认的children } } }, //请求后台接口 getarea().then((res) => { this.options = res.data })
转载地址:http://rkylf.baihongyu.com/