fix(components): [tree]: fix dynamic binding defaultCheckedKeys trigger rerender (#21503)

* fix(components): [tree]: Fix Dynamic Binding Expression

Fix issue #21130

* fix(components): [tree]: Fix Dynamic Binding Expression

* fix(components): [tree]: Fix Dynamic Binding Expression

* fix(components): [tree]: Fix Dynamic Binding Expression
This commit is contained in:
Spaceman
2025-07-28 06:08:38 +08:00
committed by GitHub
parent ddee12c481
commit 719f8ed5b5

View File

@@ -57,6 +57,7 @@ import { useNodeExpandEventBroadcast } from './model/useNodeExpandEventBroadcast
import { useDragNodeHandler } from './model/useDragNode'
import { useKeydown } from './model/useKeydown'
import { ROOT_TREE_INJECTION_KEY } from './tokens'
import { isEqual } from 'lodash-unified'
import type Node from './model/node'
import type { ComponentInternalInstance, PropType } from 'vue'
@@ -224,7 +225,9 @@ export default defineComponent({
watch(
() => props.defaultCheckedKeys,
(newVal) => {
(newVal, oldVal) => {
if (isEqual(newVal, oldVal)) return
store.value.setDefaultCheckedKey(newVal ?? [])
}
)