| | |
| | | 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', |
| | |
| | | expandedKeys: props.expandedKeys || [], |
| | | selectedKeys: props.selectedKeys || [], |
| | | checkedKeys: props.checkedKeys || [], |
| | | halfCheckedKeys: props.halfCheckedKeys|| [], |
| | | halfCheckedKeys: props.halfCheckedKeys || [], |
| | | }); |
| | | |
| | | const searchState = reactive({ |
| | |
| | | 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'); |
| | | }); |
| | |
| | | } |
| | | }, |
| | | ); |
| | | |
| | | |
| | | function handleSearch(searchValue: string) { |
| | | if (searchValue !== searchState.searchText) searchState.searchText = searchValue; |
| | |
| | | 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 ( |
| | |
| | | checkable={checkable} |
| | | checkAll={checkAll} |
| | | expandAll={expandAll} |
| | | onHandleAdd = {handleAdd} |
| | | onHandleAdd={handleAdd} |
| | | title={title} |
| | | search={search} |
| | | toolbar={toolbar} |
| | |
| | | {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)} |