Skip to content

Commit 1e9dcb8

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/anu-vue/src/components/switch/ASwitch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const ASwitch = defineComponent({
5353
},
5454
emits: ['update:modelValue'],
5555
setup(props, { slots, attrs, emit }) {
56-
const elementId = `a-switch-${attrs.id || attrs.value || Math.random().toString(36).slice(2, 7)}`
56+
const elementId = `a-switch-${attrs.id || attrs.value}-${Math.random().toString(36).slice(2, 7)}`
5757
const data = useVModel(props, 'modelValue', emit)
5858

5959
const dotPosition = computed(() => {

0 commit comments

Comments
 (0)