mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [tree] the value of append can be zero (#16130)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @ts-nocheck
|
||||
import { hasOwn, isObject } from '@element-plus/utils'
|
||||
import { hasOwn, isObject, isPropAbsent } from '@element-plus/utils'
|
||||
import Node from './node'
|
||||
import { getNodeKey } from './util'
|
||||
|
||||
@@ -144,7 +144,9 @@ export default class TreeStore {
|
||||
}
|
||||
|
||||
append(data: TreeNodeData, parentData: TreeNodeData | TreeKey | Node): void {
|
||||
const parentNode = parentData ? this.getNode(parentData) : this.root
|
||||
const parentNode = !isPropAbsent(parentData)
|
||||
? this.getNode(parentData)
|
||||
: this.root
|
||||
|
||||
if (parentNode) {
|
||||
parentNode.insertChild({ data })
|
||||
|
||||
Reference in New Issue
Block a user