Skip to content

Commit e697f1d

Browse files
committed
fix: correct change event emission in toggle function for switch component
1 parent 85fd1c4 commit e697f1d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/components/Switch/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts">
2+
import { nextTick } from 'vue'
3+
24
interface Props {
35
size?: 'default' | 'small'
46
border?: 'default' | 'square'
@@ -18,7 +20,7 @@ const emits = defineEmits(['change'])
1820
const toggle = () => {
1921
if (props.disabled) return
2022
model.value = !model.value
21-
emits('change', model.value)
23+
nextTick(() => emits('change', model.value))
2224
}
2325
</script>
2426

0 commit comments

Comments
 (0)