第一级单选,二三级多选
html
<el-cascader
v-model="value"
:options="options"
:props="props"
clearable
@change=“change”
></el-cascader>
js
data里面要存tag,value,options(下拉框数据),props: { multiple: true }(多选),
change(item) {
item.some((i) => {
if (i[0] != this.tag) {
this.tag = i[0];
return true;
}
// console.log(i)
}); // 如切换勾选,则让标识符的值等于勾选的父级的value
let filterd = item.filter((v) => v[0] == this.tag); // 过滤出与标识符相符的选项
this.value= [];
this.value.push(...filterd);
}