Element UI version
2.15.1
OS/Browsers version
mac
Vue version
2.6.10
Reproduction Link
https://jsfiddle.net/5pjnqs4u/5/
Steps to reproduce
<template>
<div class="custom-tree-container">
<el-button @click="add()">testbutton</el-button>
<div class="block">
<p>render-content</p>
<el-tree
:data="data"
node-key="id"
ref="sideTree"
:expand-on-click-node="true">
</el-tree>
</div>
</div>
</template>
<script>
export default {
data() {
return {
id: 0,
// data: this.$store.state.sidebar.menu
data: [
{
id: 1,
label: 'nodea',
children: [
{
id: 3,
label: 'nodea3',
children: [{
id: 5,
label: 'nodea5',
}],
}, {
id: 4,
label: 'nodea4',
children: [],
}
],
}, {
id: 2,
label: 'nodeb',
children: {}
}
]
}
},
mounted() {
this.data.push({
id: 117,
label: 'oooo',
children: [],
})
// this.data.splice(1, 1)
console.log('children:', this.data[0].children[0].children)
this.data[0].children[0].children.push({
id: 817,
label: 'xxxx',
children: [],
})
// console.log("data,", this.data)
},
methods: {
add() {
this.data[0].children[0].children.push({
id: 1017,
label: 'addxxxx',
children: [],
})
},
}
};
</script>
What is Expected?
- 页面初次载入后,应该可以看到节点xxxx,但是并没有.
节点ooo可以看到.
What is actually happening?
- 没有看到节点xxxx,但是看到了节点oooo
- 点击testbutton,然后看到了节点xxxx和addxxxx
5条答案
按热度按时间ubof19bj1#
Translation of this issue:
Element UI version
2.15.1
OS/Browsers version
mac
Vue version
2.6.10
Reproduction Link
https://elementui.github.io/issue-generator
Steps to reproduce
What is Expected?
Node OOo can be seen
What is actually happening?
5us2dqdw2#
数组的深度为1时的push,能够得到view的响应,但是深度为3时就得不到了view的响应,感觉很奇怪.
guicsvcw3#
@element-bot Reproduction Link is https://jsfiddle.net/5pjnqs4u/5/
ldxq2e6h4#
there are two ways two fix this problem:
3okqufwl5#
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.