Ben Lin
2025-03-08 858b9bccead46cdefc99325b7c956d50a2964309
src/components/TigerTree/src/TigerTree.vue
@@ -33,6 +33,7 @@
  import { CreateContextOptions } from '/@/components/ContextMenu';
  import { treeEmits, treeProps } from './types/tree';
  import { createBEM } from '/@/utils/bem';
import { EventDataNode } from 'ant-design-vue/es/tree';
  export default defineComponent({
    name: 'TigerTree',
@@ -47,7 +48,7 @@
        expandedKeys: props.expandedKeys || [],
        selectedKeys: props.selectedKeys || [],
        checkedKeys: props.checkedKeys || [],
        halfCheckedKeys: props.halfCheckedKeys|| [],
        halfCheckedKeys: props.halfCheckedKeys || [],
      });
      const searchState = reactive({
@@ -109,6 +110,12 @@
            emit('gethalfCheckedKeys', toRaw(state.halfCheckedKeys));
          },
          onRightClick: handleRightClick,
          onClick: (e: MouseEvent, node: EventDataNode) => {
            if(node.selected){
              console.log(state.selectedKeys, node);
              emit('unselect', node);
            }
          }
        };
        return omit(propsData, 'treeData', 'class');
      });
@@ -221,7 +228,6 @@
          }
        },
      );
      function handleSearch(searchValue: string) {
        if (searchValue !== searchState.searchText) searchState.searchText = searchValue;
@@ -438,7 +444,7 @@
      expose(instance);
      return () => {
        const { title, helpMessage, toolbar,add,search, checkable } = props;
        const { title, helpMessage, toolbar, add, search, checkable } = props;
        const showTitle = title || toolbar || search || slots.headerTitle;
        const scrollStyle: CSSProperties = { height: 'calc(100% - 38px)' };
        return (
@@ -448,7 +454,7 @@
                checkable={checkable}
                checkAll={checkAll}
                expandAll={expandAll}
                onHandleAdd = {handleAdd}
                onHandleAdd={handleAdd}
                title={title}
                search={search}
                toolbar={toolbar}
@@ -461,13 +467,18 @@
                {extendSlots(slots)}
              </TreeHeader>
            )}
              <Spin
            <Spin
              wrapperClassName={unref(props.treeWrapperClassName)}
              spinning={unref(props.loading)}
              tip="加载中..."
            >
              <ScrollContainer style={scrollStyle} v-show={!unref(getNotFound)}>
                <Tree {...unref(getBindValues)} showIcon={false} disabled={props.disabled} treeData={treeData.value} />
                <Tree
                  {...unref(getBindValues)}
                  showIcon={false}
                  disabled={props.disabled}
                  treeData={treeData.value}
                />
              </ScrollContainer>
              <Empty
                v-show={unref(getNotFound)}