Skip to content

Commit 15ec0db

Browse files
committed
fix loading icon
1 parent 327c61e commit 15ec0db

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/table/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function treeCellPrefix(h, { row, treeNode, store }) {
106106
if (treeNode.indent) {
107107
ele.push(<span class="el-table__indent" style={{'padding-left': treeNode.indent + 'px'}}></span>);
108108
}
109-
if (typeof treeNode.expanded === 'boolean') {
109+
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
110110
const expandClasses = ['el-table__expand-icon', treeNode.expanded ? 'el-table__expand-icon--expanded' : ''];
111111
let iconClasses = ['el-icon-arrow-right'];
112112
if (treeNode.loading) {

packages/table/src/table-body.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,12 @@ export default {
355355
if (typeof treeRowData.expanded === 'boolean') {
356356
data.treeNode.expanded = treeRowData.expanded;
357357
// 表明是懒加载
358-
if (typeof treeRowData.loading === 'boolean') {
358+
if ('loading' in treeRowData) {
359359
data.treeNode.loading = treeRowData.loading;
360360
}
361+
if ('noLazyChildren' in treeRowData) {
362+
data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
363+
}
361364
}
362365
}
363366
return (
@@ -415,6 +418,9 @@ export default {
415418
level: cur.level,
416419
display: true
417420
};
421+
if (typeof cur.loaded === 'boolean' && cur.loaded) {
422+
treeRowData.noLazyChildren = !(cur.children && cur.children.length);
423+
}
418424
if (typeof cur.loading === 'boolean') {
419425
treeRowData.loading = cur.loading;
420426
}
@@ -445,6 +451,9 @@ export default {
445451
// 懒加载的某些节点,level 未知
446452
cur.level = cur.level || innerTreeRowData.level;
447453
cur.display = !!(cur.expanded && innerTreeRowData.display);
454+
if (typeof cur.loaded === 'boolean' && cur.loaded) {
455+
innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
456+
}
448457
if (typeof cur.lazy === 'boolean') {
449458
innerTreeRowData.loading = cur.loading;
450459
}

0 commit comments

Comments
 (0)