Skip to content

Commit

Permalink
fix: fix tree feedback bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhaocl1997 committed May 17, 2021
1 parent 84a9aeb commit f6e6a17
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/UI/Tree/src/hooks/useTreeFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { WTreeProps, ElTreeRef, TreeKey } from '../types'

import { nextTick, onMounted, watch } from 'vue'

import { easyIsEmpty, except } from 'easy-fns-ts'
import { easyIsEmpty } from 'easy-fns-ts'

export const useTreeFeedback = (
props: ComputedRef<WTreeProps>,
Expand Down Expand Up @@ -31,16 +31,13 @@ export const useTreeFeedback = (
}

if (props.value.multiple) {
const levelOneNodeIdArr = props.value.data!.map((i) => i[nodeKey])
const val = except(props.value.modelValue as TreeKey[], levelOneNodeIdArr)

setTimeout(() => {
treeRef.value!.setCheckedKeys(val)
}, 50)
treeRef.value?.setCheckedKeys(props.value.modelValue as TreeKey[])
}, 0)
} else {
setTimeout(() => {
treeRef.value!.setCurrentKey(props.value.modelValue as TreeKey)
}, 50)
treeRef.value?.setCurrentKey(props.value.modelValue as TreeKey)
}, 0)
}
}

Expand All @@ -52,6 +49,9 @@ export const useTreeFeedback = (
() => props.value.modelValue,
() => {
feedback()
},
{
deep: true,
}
)
}

0 comments on commit f6e6a17

Please sign in to comment.