update Tree
update Tree(in Vue 2,can not use this.xxx in template’s prop,just xxx)
This commit is contained in:
parent
e2c6ff2b67
commit
9d79a51f0d
2 changed files with 13 additions and 9 deletions
|
@ -18,8 +18,8 @@
|
|||
v-if="!item.isLeaf"
|
||||
v-show="item.expand"
|
||||
:class="expandCls(item)"
|
||||
:value="item.children"
|
||||
:name="item.name+'.'+index"
|
||||
:data="item.children"
|
||||
:name="name+'.'+index"
|
||||
:multiple="multiple"
|
||||
:show-checkbox="showCheckbox"></Tree>
|
||||
</transition>
|
||||
|
@ -39,7 +39,7 @@
|
|||
components: { Icon, Checkbox },
|
||||
mixins: [ Emitter ],
|
||||
props: {
|
||||
value: {
|
||||
data: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
|
@ -66,8 +66,7 @@
|
|||
},
|
||||
data () {
|
||||
return {
|
||||
prefixCls: prefixCls,
|
||||
data: this.value
|
||||
prefixCls: prefixCls
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -80,9 +79,6 @@
|
|||
}
|
||||
},
|
||||
watch: {
|
||||
value (val) {
|
||||
this.data = val;
|
||||
},
|
||||
data () {
|
||||
if (this.name === '0') {
|
||||
this.setKey();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<template>
|
||||
<Tree v-model="baseData" show-checkbox></Tree>
|
||||
<div>
|
||||
<Tree :data="baseData" show-checkbox></Tree>
|
||||
<div @click="c">change</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
|
@ -28,6 +31,11 @@
|
|||
}]
|
||||
}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
c () {
|
||||
this.baseData[0].expand = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue