|
|
@@ -0,0 +1,37 @@
|
|
|
+<template>
|
|
|
+ <el-tree
|
|
|
+ :data="props.data"
|
|
|
+ :props="defaultProps"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ node-key="code"
|
|
|
+ :default-checked-keys="['C12-200-01']"
|
|
|
+ ref="treeRef"
|
|
|
+ :default-expand-all="true"
|
|
|
+ />
|
|
|
+</template>
|
|
|
+<script lang="ts" setup>
|
|
|
+ import { ElTree } from 'element-plus';
|
|
|
+ import { ref, watch } from 'vue';
|
|
|
+ const props = defineProps<{ data }>();
|
|
|
+ const defaultProps = {
|
|
|
+ children: 'children',
|
|
|
+ label: 'name',
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleNodeClick = (...e) => {
|
|
|
+ console.log('e', ...e);
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ const treeRef = ref(null);
|
|
|
+
|
|
|
+ // watch(
|
|
|
+ // () => props.data,
|
|
|
+ // () => {
|
|
|
+ // console.log('data', props.data);
|
|
|
+ // treeRef.value?.setCheckedNodes(['C12-200-01']);
|
|
|
+ // },
|
|
|
+ // { deep: true, immediate: true },
|
|
|
+ // );
|
|
|
+</script>
|
|
|
+<style scoped></style>
|