options: {
value: 'id',
label: 'name',
children: "children", //级联狂邦值
checkStrictly: true
}
<el-form-item>
<div class="m-4">
<el-form-item label="部门:">
<el-cascader placeholder="请选择部门" v-model="state.pages.depid" :options="state.department"
:props="state.options" @change="handleChange" clearable />
</el-form-item>
</div>
</el-form-item>
<el-form-item label="班级:">
<el-select :disabled="disabled" v-model="state.pages.classid" placeholder="请选择">
<el-option label="" value="" />
<el-option label="" value="" />
</el-select>
</el-form-item>
const disabled = ref<boolean>(true)//禁用属性
//获取级联选择器的 id 搜索
const handleChange = (value: any) => {
if (value) {
//班级禁用
disabled.value=!disabled.value
//获取最后一个id
state.pages.depid = value[value.length - 1]
console.log(state.pages.depid);
getcalss()
} else {
disabled.value=!disabled.value
getlist()
}
}