Skip to content

Commit ca3b019

Browse files
committed
fix variable name
1 parent 6e25310 commit ca3b019

File tree

8 files changed

+17
-19
lines changed

8 files changed

+17
-19
lines changed

examples/docs/en-US/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ When the row content is too long and you do not want to display the horizontal s
13321332

13331333
### Tree data and lazy mode
13341334

1335-
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `isLeaf` attribute in row to determine which row contains children.
1335+
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `hasChildren` attribute in row to determine which row contains children.
13361336

13371337
```html
13381338
<template>
@@ -1419,7 +1419,7 @@ When the row content is too long and you do not want to display the horizontal s
14191419
id: 3,
14201420
date: '2016-05-01',
14211421
name: 'wangxiaohu',
1422-
isLeaf: true
1422+
hasChildren: true
14231423
}, {
14241424
id: 4,
14251425
date: '2016-05-03',

examples/docs/es/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ Cuando el contenido de la fila es demasiado largo y busca no mostrar la barra de
13341334

13351335
### Tree data and lazy mode
13361336

1337-
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `isLeaf` attribute in row to determine which row contains children.
1337+
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `hasChildren` attribute in row to determine which row contains children.
13381338

13391339
```html
13401340
<template>
@@ -1421,7 +1421,7 @@ Cuando el contenido de la fila es demasiado largo y busca no mostrar la barra de
14211421
id: 3,
14221422
date: '2016-05-01',
14231423
name: 'wangxiaohu',
1424-
isLeaf: true
1424+
hasChildren: true
14251425
}, {
14261426
id: 4,
14271427
date: '2016-05-03',

examples/docs/fr-FR/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ Lorsque le contenu d'une ligne est trop long et que vous ne souhaitez pas affich
13351335

13361336
### Tree data and lazy mode
13371337

1338-
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `isLeaf` attribute in row to determine which row contains children.
1338+
:::demo You can display tree structure data。When using it, the prop `row-key` is required。Also, child row data can be loaded asynchronously. Set `lazy` property of Table to true and the function `load`. Specify `hasChildren` attribute in row to determine which row contains children.
13391339

13401340
```html
13411341
<template>
@@ -1422,7 +1422,7 @@ Lorsque le contenu d'une ligne est trop long et que vous ne souhaitez pas affich
14221422
id: 3,
14231423
date: '2016-05-01',
14241424
name: 'wangxiaohu',
1425-
isLeaf: true
1425+
hasChildren: true
14261426
}, {
14271427
id: 4,
14281428
date: '2016-05-03',

examples/docs/zh-CN/table.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@
12771277

12781278
### 树形数据与懒加载
12791279

1280-
:::demo 支持树类型的数据。此时,必须要指定 `row-key`。支持子节点数据异步加载。设置 Table 的 `lazy` 属性为 true 与 加载函数 `load` ,指定 row 中的 `isLeaf` 来确定哪些行是包含子节点。
1280+
:::demo 支持树类型的数据。此时,必须要指定 `row-key`。支持子节点数据异步加载。设置 Table 的 `lazy` 属性为 true 与 加载函数 `load` ,指定 row 中的 `hasChildren` 来确定哪些行是包含子节点。
12811281

12821282
```html
12831283
<template>
@@ -1381,7 +1381,7 @@
13811381
date: '2016-05-01',
13821382
name: '王小虎',
13831383
address: '上海市普陀区金沙江路 1519 弄',
1384-
isLeaf: true
1384+
hasChildren: true
13851385
}, {
13861386
id: 4,
13871387
date: '2016-05-03',

packages/table/src/table-body.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default {
9797
};
9898
if (cellIndex === this.firstDefaultColumnIndex && treeNode) {
9999
data.treeNode = {
100-
isLeaf: treeNode.isLeaf || (treeNode.children && treeNode.children.length),
100+
hasChildren: treeNode.hasChildren || (treeNode.children && treeNode.children.length),
101101
expanded: treeNode.expanded,
102102
indent: treeNode.level * this.treeIndent,
103103
level: treeNode.level,

packages/table/src/table-column.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ export default {
449449
if (!data.treeNode) return null;
450450
const ele = [];
451451
ele.push(<span class="el-table__indent" style={{'padding-left': data.treeNode.indent + 'px'}}></span>);
452-
if (data.treeNode.isLeaf) {
452+
if (data.treeNode.hasChildren) {
453453
ele.push(<div class={ ['el-table__expand-icon', data.treeNode.expanded ? 'el-table__expand-icon--expanded' : '']}
454454
on-click={this.handleTreeExpandIconClick.bind(this, data)}>
455455
<i class='el-icon el-icon-arrow-right'></i>

packages/table/src/table-store.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,9 @@ TableStore.prototype.loadData = function(row, treeNode) {
735735
display: true,
736736
level: parent.level + 1
737737
};
738-
if (item.isLeaf) {
738+
if (item.hasChildren) {
739739
child.expanded = false;
740-
child.isLeaf = true;
740+
child.hasChildren = true;
741741
child.children = [];
742742
}
743743
Vue.set(treeData, rowKey, child);

packages/table/src/table.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,22 +509,20 @@
509509
};
510510
if (data) {
511511
data.forEach(item => {
512-
const hasChildren = Array.isArray(item.children) && item.children.length;
513-
const isLeaf = item.isLeaf;
514-
if (!(hasChildren || isLeaf)) return;
515-
512+
const containChildren = Array.isArray(item.children) && item.children.length;
513+
if (!(containChildren || item.hasChildren)) return;
516514
const rowKey = this.getRowKey(item);
517515
const treeNode = {
518516
level: 0,
519517
expanded: false,
520518
display: true,
521519
children: []
522520
};
523-
if (hasChildren) {
521+
if (containChildren) {
524522
treeData[rowKey] = treeNode;
525523
traverse(item.children, treeData[rowKey], 1);
526-
} else if (isLeaf) {
527-
treeNode.isLeaf = true;
524+
} else if (item.hasChildren && this.lazy) {
525+
treeNode.hasChildren = true;
528526
treeNode.loaded = false;
529527
treeData[rowKey] = treeNode;
530528
}

0 commit comments

Comments
 (0)