fix(BasicTree): Resolve ts type error

pull/38/head
xingyu 2023-10-23 09:49:32 +08:00
parent 007ac38d5f
commit 8e25a3aa09
2 changed files with 4 additions and 3 deletions

View File

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

View File

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