2016-11-02 17:41:16 +08:00
|
|
|
<template>
|
2017-03-02 12:22:15 +08:00
|
|
|
<div>
|
2017-10-26 11:57:24 +08:00
|
|
|
<Tag checkable>标签一</Tag>
|
|
|
|
<Tag>标签二</Tag>
|
|
|
|
<Tag v-if="show" closable @on-close="handleClose">标签三</Tag>
|
|
|
|
<br><br>
|
|
|
|
<Tag type="border" checkable>标签三</Tag>
|
|
|
|
<Tag type="border" closable>标签四</Tag>
|
|
|
|
<Tag type="dot">标签一</Tag>
|
|
|
|
<Tag type="dot" closable>标签二</Tag>
|
|
|
|
<br><br>
|
|
|
|
<Tag closable color="blue" checkable>标签一</Tag>
|
|
|
|
<Tag closable color="green" checkable>标签二</Tag>
|
|
|
|
<Tag closable color="red" checkable>标签三</Tag>
|
|
|
|
<Tag closable color="yellow" checkable>标签四</Tag>
|
|
|
|
<br><br>
|
|
|
|
<Tag type="border" closable color="blue" checkable>标签一</Tag>
|
|
|
|
<Tag type="border" closable color="green">标签二</Tag>
|
|
|
|
<Tag type="border" closable color="red">标签三</Tag>
|
|
|
|
<Tag type="border" closable color="yellow">标签四</Tag>
|
|
|
|
<br><br>
|
|
|
|
<Tag type="dot" closable color="blue" checkable>标签一</Tag>
|
|
|
|
<Tag type="dot" closable color="green">标签二</Tag>
|
|
|
|
<Tag type="dot" closable color="red">标签三</Tag>
|
|
|
|
<Tag type="dot" closable color="yellow">标签四</Tag>
|
|
|
|
<br><br>
|
|
|
|
<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>
|
2017-03-02 12:22:15 +08:00
|
|
|
</div>
|
2016-11-02 17:41:16 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
2016-11-03 13:54:21 +08:00
|
|
|
data () {
|
|
|
|
return {
|
2017-10-26 11:57:24 +08:00
|
|
|
show: true,
|
|
|
|
count: [0, 1, 2]
|
2017-10-18 17:13:06 +09:00
|
|
|
};
|
2016-11-09 17:36:40 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2017-10-26 11:57:24 +08:00
|
|
|
handleClose () {
|
|
|
|
this.show = false;
|
2017-10-18 17:13:06 +09:00
|
|
|
},
|
2017-10-26 11:57:24 +08:00
|
|
|
handleAdd () {
|
|
|
|
if (this.count.length) {
|
|
|
|
this.count.push(this.count[this.count.length - 1] + 1);
|
|
|
|
} else {
|
|
|
|
this.count.push(0);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleClose2 (event, name) {
|
|
|
|
const index = this.count.indexOf(name);
|
|
|
|
this.count.splice(index, 1);
|
2016-11-03 13:54:21 +08:00
|
|
|
}
|
|
|
|
}
|
2017-10-18 17:13:06 +09:00
|
|
|
};
|
2016-11-02 17:41:16 +08:00
|
|
|
</script>
|