From 7e631cf61c3605a1b61e9bbeeb2d870dc1614755 Mon Sep 17 00:00:00 2001 From: keray <1172304645@qq.com> Date: Tue, 13 Sep 2022 15:01:59 +0800 Subject: [PATCH] Tree: fix lazy-load check problem (#21934) --- packages/tree/src/model/node.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/tree/src/model/node.js b/packages/tree/src/model/node.js index c72299582f4..0281d3ba3e0 100644 --- a/packages/tree/src/model/node.js +++ b/packages/tree/src/model/node.js @@ -23,7 +23,7 @@ export const getChildState = node => { }; const reInitChecked = function(node) { - if (node.childNodes.length === 0) return; + if (node.childNodes.length === 0 || node.loading) return; const {all, none, half} = getChildState(node.childNodes); if (all) { @@ -463,12 +463,11 @@ export default class Node { this.loading = true; const resolve = (children) => { - this.loaded = true; - this.loading = false; this.childNodes = []; this.doCreateChildren(children, defaultProps); - + this.loaded = true; + this.loading = false; this.updateLeafState(); if (callback) { callback.call(this, children);