Skip to content

Commit 37f25b0

Browse files
committed
fix(checkbox): input id isn't unique if same value is used twice
1 parent 27fa5d7 commit 37f25b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const ACheckbox = defineComponent({
4545
disabled,
4646
},
4747
setup(props, { slots, attrs, emit }) {
48-
const elementId = `a-checkbox-${attrs.id || attrs.value || Math.random().toString(36).slice(2, 7)}`
48+
const elementId = `a-checkbox-${attrs.id || attrs.value}-${Math.random().toString(36).slice(2, 7)}`
4949
const data = useVModel(props, 'modelValue', emit)
5050

5151
return () => <label class={['inline-flex items-center cursor-pointer', props.disabled && 'a-checkbox-disabled pointer-events-none']} for={elementId}>

0 commit comments

Comments
 (0)