Commit 2c6c41be34a97b284a9a2f4dc26feff5c217a535
1 parent
ca131354
add event 'on-click' for Tag
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
src/components/tag/tag.vue
1 | <template> | 1 | <template> |
2 | <transition name="fade"> | 2 | <transition name="fade"> |
3 | - <div :class="classes"> | 3 | + <div :class="classes" @click.native.stop="clickTag"> |
4 | <span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click.native.stop="close"></Icon> | 4 | <span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click.native.stop="close"></Icon> |
5 | </div> | 5 | </div> |
6 | </transition> | 6 | </transition> |
@@ -61,6 +61,13 @@ | @@ -61,6 +61,13 @@ | ||
61 | } else { | 61 | } else { |
62 | this.$emit('on-close', event, this.name); | 62 | this.$emit('on-close', event, this.name); |
63 | } | 63 | } |
64 | + }, | ||
65 | + clickTag (event) { | ||
66 | + if (this.name === undefined) { | ||
67 | + this.$emit('on-click', event); | ||
68 | + } else { | ||
69 | + this.$emit('on-click', event, this.name); | ||
70 | + } | ||
64 | } | 71 | } |
65 | } | 72 | } |
66 | }; | 73 | }; |