<el-tree
ref="treeRef"
:data="dataTree"
:props="defaultProps"
node-key="id"
show-checkbox
default-expand-all
:check-strictly="true"
:default-checked-keys="check_id"
@check-change="handleNodeClick"
/>
const props = defineProps<{
dialogEdit: boolean;
ID: Array<string>;
}>();
watch(
() => props.dialogEdit,
() => {
dialogEdit.value = props.dialogEdit; /// 弹窗显示的值
check_id.value = props.ID; /// tree组件回显的值
console.log("111111111111111111", check_id.value);
getTree();
}
);
Element-ui中关闭dialog时隐藏组件并销毁原创,你可以搜一下这个
大概意思就是给dialog 增加 v-if