Skip to content

Commit d8efaa5

Browse files
committed
fix(checkbox): emit single event on input
1 parent 180778b commit d8efaa5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/anu-vue/src/components/checkbox/ACheckbox.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ const props = defineProps({
2525
*/
2626
icon: defu({ default: 'i-bx-check' }, configurableProp),
2727
28+
/**
29+
* Bind classes to input element
30+
*/
31+
inputClasses: { type: null },
32+
2833
/**
2934
* Disable checkbox
3035
*/
@@ -42,6 +47,7 @@ const emit = defineEmits<{
4247
4348
defineOptions({
4449
name: 'ACheckbox',
50+
inheritAttrs: false,
4551
})
4652
4753
const attrs = useAttrs()
@@ -75,15 +81,18 @@ const state = computed(() => {
7581
<label
7682
:for="elementId"
7783
class="inline-flex items-center cursor-pointer"
78-
:class="[props.disabled && 'a-checkbox-disabled pointer-events-none']"
84+
:class="[
85+
$attrs.class,
86+
props.disabled && 'a-checkbox-disabled pointer-events-none',
87+
]"
7988
>
8089
<input
90+
v-bind="{ ...$attrs, class: props.inputClasses }"
8191
:id="elementId"
8292
:ref="refCheckbox"
8393
v-model="data"
8494
class="hidden"
8595
type="checkbox"
86-
v-bind="attrs"
8796
>
8897
<div
8998
class="a-checkbox-box flex items-center justify-center shrink-0"

0 commit comments

Comments
 (0)