Skip to content

Commit 852c5f8

Browse files
committed
visiable 调整为计算属性,以使得可以跟随prop动态改变
1 parent 5c0f54e commit 852c5f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/app.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@
116116
},
117117
data () {
118118
return {
119-
visiable: this.currentDeep <= this.deep,
120119
treeContentBackground: 'transparent',
121120
checkboxVal: this.pathChecked.includes(this.path) // 复选框的值
122121
}
123122
},
124123
computed: {
124+
// 当前树是否可展开
125+
visiable () {
126+
return this.currentDeep <= this.deep
127+
},
125128
// 获取当前 data 中最后一项的 key 或 索引, 便于界面判断是否添加 ","
126129
lastIndex () {
127130
if (Array.isArray(this.parentData)) {

0 commit comments

Comments
 (0)