vue项目根据后端返回级联选择器
<el-form-item label="资料" prop="Ids">
<el-cascader :options="options" :props="props" clearable v-model="form.Ids" />
</el-form-item>
props: { multiple: true,label:'Name',value:'Id',children:'train' },
options: [],
getlName() {
listNew(this.Params).then((res) => {
this.options = res.rows
this.options.forEach(item => {
item.train = item.train.map(item => {
return {
Id: item.Id,
Name: item.Name
}
})
})
}
const arr = []
this.form.Ids.forEach((val, index) => {
arr.push(val[1]);
});
this.form.Ids = arr