This commit is contained in:
Piotr 2024-12-17 11:11:57 +01:00 committed by GitHub
commit 733ad68e17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 20 deletions

View File

@ -1,22 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
import { useVModel } from '@vueuse/core'
const props = defineProps<{ const props = defineProps<{
class?: HTMLAttributes['class'] class?: HTMLAttributes['class']
defaultValue?: string | number defaultValue?: string | number
modelValue?: string | number
}>() }>()
const emits = defineEmits<{ const modelValue = defineModel<string | number>()
(e: 'update:modelValue', payload: string | number): void modelValue.value = props.defaultValue
}>()
const modelValue = useVModel(props, 'modelValue', emits, {
passive: true,
defaultValue: props.defaultValue,
})
</script> </script>
<template> <template>

View File

@ -1,22 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
import { useVModel } from '@vueuse/core'
const props = defineProps<{ const props = defineProps<{
class?: HTMLAttributes['class'] class?: HTMLAttributes['class']
defaultValue?: string | number defaultValue?: string | number
modelValue?: string | number
}>() }>()
const emits = defineEmits<{ const modelValue = defineModel<string | number>()
(e: 'update:modelValue', payload: string | number): void modelValue.value = props.defaultValue
}>()
const modelValue = useVModel(props, 'modelValue', emits, {
passive: true,
defaultValue: props.defaultValue,
})
</script> </script>
<template> <template>