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

View File

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