<el-cascader
v-model="organSelecList"
:change-on-select="true"
:options="companyBenlist"
placeholder="请选择组织级别"
:props="{ value: 'id', label: 'name',checkStrictly: true}"
@change="handlechange"
size="mini"
clearable>
</el-cascader>
organSelecList获取的是一个数组集合
clearable可清空
companyBenlist是要遍历的数组对象,如果是后台返回的最后一级有children空对象,可以通过回调函数去除空白
getTreeData(data) {
for(var i = 0; i < data.length; i++) {
if(data[i].children.length < 1) {
data[i].children = undefined;
} else {
this.getTreeData(data[i].children);
}
}
return data;
},