import { defineComponent, computed, ref } from 'vue' import TreeNode from './treeNode.tsx' import Tree from './tree.tsx' const treeContent = defineComponent({ name: 'treeContent', props: { data: { type: Object }, checkable: { type: Boolean }, }, emits: ['change'], setup(props) { //箭头向右则隐藏子节点 const arrowState = ref(false) const isTreeHidden = computed(() => { return arrowState.value ? 'u-tree-hidden' : '' }) //箭头通过父接节点将状态发送到兄弟节点 const onArrowChange = () => { arrowState.value = !arrowState.value } //选中多选当前框,所有父和子节点全部要选中 const onCheckedChange = (value) => { console.log(value) } return () => ( <> {/* 没有孩子则不渲染 */} {props.data.children && ( )} ) }, }) export default treeContent /* * Because of the particularity of component recursion * We must pull of the sibling node TreeContent * to manage the state of them */