This commit is contained in:
梁灏 2018-12-20 16:37:30 +08:00
parent 2b6e6d4c90
commit 5776bcbf06
2 changed files with 17 additions and 1 deletions

View file

@ -62,6 +62,13 @@
<br><br> <br><br>
<Tag v-for="item in count" :key="item" :name="item" closable @on-close="handleClose2">标签{{ item + 1 }}</Tag> <Tag v-for="item in count" :key="item" :name="item" closable @on-close="handleClose2">标签{{ item + 1 }}</Tag>
<Button icon="ios-plus-empty" type="dashed" size="small" @click="handleAdd">添加标签</Button> <Button icon="ios-plus-empty" type="dashed" size="small" @click="handleAdd">添加标签</Button>
<br><br><hr><br>
<Tag :checked="checked" checkable>test</Tag>
<Button @click="toggle">
Toggle
</Button>
<span>{{ checked }}</span>
</div> </div>
</template> </template>
<script> <script>
@ -69,7 +76,8 @@
data () { data () {
return { return {
show: true, show: true,
count: [0, 1, 2] count: [0, 1, 2],
checked: true
}; };
}, },
methods: { methods: {
@ -86,6 +94,9 @@
handleClose2 (event, name) { handleClose2 (event, name) {
const index = this.count.indexOf(name); const index = this.count.indexOf(name);
this.count.splice(index, 1); this.count.splice(index, 1);
},
toggle() {
this.checked = !this.checked;
} }
} }
}; };

View file

@ -137,6 +137,11 @@
this.$emit('on-change', checked, this.name); this.$emit('on-change', checked, this.name);
} }
} }
},
watch: {
checked (val) {
this.isChecked = val;
}
} }
}; };
</script> </script>