From 7f8991a664fc5c45dac98b4f769b3d070609989d Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Wed, 8 Nov 2017 14:09:44 +0800 Subject: [PATCH] Tree: fix updateChildren --- examples/app.vue | 10 +++++----- examples/nav.config.json | 4 ++-- packages/tree/src/model/tree-store.js | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/app.vue b/examples/app.vue index 02bc19dc4..fa72ee15d 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -236,12 +236,12 @@ this.suggestJump(); } setTimeout(() => { - const notified = localStorage.getItem('RELEASE_NOTIFIED'); + const notified = localStorage.getItem('ES_NOTIFIED'); if (!notified) { const h = this.$createElement; const title = this.lang === 'zh-CN' - ? '2.0 正式发布' - : '2.0 available now'; + ? '帮助我们完成西班牙语文档' + : 'Help us with Spanish docs'; const messages = this.lang === 'zh-CN' ? ['点击', '这里', '查看详情'] : ['Click ', 'here', ' to learn more']; @@ -253,13 +253,13 @@ h('a', { attrs: { target: '_blank', - href: `https://github.com/ElemeFE/element/issues/${ this.lang === 'zh-CN' ? '7755' : '7756' }` + href: 'https://github.com/ElemeFE/element/issues/8074' } }, messages[1]), messages[2] ]), onClose() { - localStorage.setItem('RELEASE_NOTIFIED', 1); + localStorage.setItem('ES_NOTIFIED', 1); } }); } diff --git a/examples/nav.config.json b/examples/nav.config.json index 27d128288..487595f2d 100644 --- a/examples/nav.config.json +++ b/examples/nav.config.json @@ -10,7 +10,7 @@ }, { "name": "Element Angular", - "href": "https://eleme.github.io/element-angular/" + "href": "https://element-angular.faas.ele.me/" }, { "name": "开发指南", @@ -260,7 +260,7 @@ }, { "name": "Element Angular", - "href": "https://eleme.github.io/element-angular/" + "href": "https://element-angular.faas.ele.me/" }, { "name": "Development", diff --git a/packages/tree/src/model/tree-store.js b/packages/tree/src/model/tree-store.js index 8afe20e9b..efc08e88b 100644 --- a/packages/tree/src/model/tree-store.js +++ b/packages/tree/src/model/tree-store.js @@ -198,9 +198,10 @@ export default class TreeStore { const node = this.nodesMap[key]; if (!node) return; const childNodes = node.childNodes; - childNodes.forEach(child => { + for (let i = childNodes.length - 1; i >= 0; i--) { + const child = childNodes[i]; this.remove(child.data); - }); + } for (let i = 0, j = data.length; i < j; i++) { const child = data[i]; this.append(child, node.data);