<el-cascader
:options="favPostIdOptions"
v-model="formData.jobChannelId"
>
<template slot-scope="{ data }">
<span>{{ data.label }}</span>
</template>
</el-cascader>
this.favPostIdOptions.forEach((m) => {
m.label = m.name;
m.value = m.jobChannelId;
if (m.children.length > 0) {
m.children.forEach((item) => {
item.label = item.name;
item.value = item.jobSubchannelId;
});
}
//主要是这块 判断如果chuildren长度为0 则为undefined
else if (m.children.length == 0) {
m.children = undefined;
}
});