Browse Source

fix(BasicTree): Resolve ts type error

main
xingyu 2 years ago
parent
commit
8e25a3aa09
  1. 5
      src/components/Tree/src/BasicTree.vue
  2. 2
      src/components/Tree/src/TreeIcon.ts

5
src/components/Tree/src/BasicTree.vue

@ -3,6 +3,7 @@ import type { CSSProperties } from 'vue'
import { computed, defineComponent, onMounted, reactive, ref, toRaw, unref, watch, watchEffect } from 'vue'
import { Empty, Spin, Tree } from 'ant-design-vue'
import { cloneDeep, difference, get, omit } from 'lodash-es'
import type { TreeProps } from 'ant-design-vue/es/tree/Tree'
import type { CheckKeys, FieldNames, KeyType, TreeActionType, TreeItem, TreeState } from './types/tree'
import TreeHeader from './components/TreeHeader.vue'
@ -98,11 +99,11 @@ export default defineComponent({
const rawVal = toRaw(state.checkedKeys)
emit('update:value', rawVal)
emit('check', state.checkStrictly ? rawVal.checked : rawVal, e)
emit('check', rawVal, e)
},
'onRightClick': handleRightClick,
}
return omit(propsData, 'treeData', 'class')
return omit(propsData, 'treeData', 'class') as TreeProps
})
const getTreeData = computed((): TreeItem[] => (searchState.startSearch ? searchState.searchData : unref(treeDataRef)))

2
src/components/Tree/src/TreeIcon.ts

@ -10,5 +10,5 @@ export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string }
if (isString(icon))
return h(Icon, { icon, class: 'mr-1' })
return Icon
return h(Icon)
}

Loading…
Cancel
Save