Skip to content

Commit 00ff781

Browse files
committed
feat: [Request] Add a clickable/ touchable feature to the q-chip component quasarframework#526
1 parent b5fffa1 commit 00ff781

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

dev/components/components/chip.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
</div>
8080
</p>
8181

82+
<q-chip avatar="/statics/boy-avatar.png" closable color="primary" @click="clickable">Jim</q-chip>
83+
8284
<p class="caption">Tag Label Chips</p>
8385
<p>
8486
<q-chip tag icon-right="mail" color="light" class="text-black">New</q-chip>
@@ -127,3 +129,13 @@
127129
</div>
128130
</div>
129131
</template>
132+
133+
<script>
134+
export default {
135+
methods: {
136+
clickable () {
137+
console.log('@click')
138+
}
139+
}
140+
}
141+
</script>

src/components/chip/QChip.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[`bg-${color}`]: color,
1212
'text-white': color
1313
}"
14+
@click="__onClick"
1415
>
1516
<div
1617
v-if="icon || avatar"
@@ -30,7 +31,7 @@
3031
v-if="closable"
3132
name="cancel"
3233
class="cursor-pointer"
33-
@click="$emit('close')"
34+
@click.stop="$emit('close')"
3435
></q-icon>
3536
</div>
3637
</div>
@@ -59,6 +60,11 @@ export default {
5960
avatar: String,
6061
closable: Boolean,
6162
detail: Boolean
63+
},
64+
methods: {
65+
__onClick (e) {
66+
this.$emit('click', e)
67+
}
6268
}
6369
}
6470
</script>

0 commit comments

Comments
 (0)