This commit is contained in:
vadim committed 2026-09-25 16:41:06 +03:00
1 parent bb4ddf3f36
commit 0ce91bd0e5
6 files changed
+57 -18

No files matched your search

+19 -5
View File
@@ -1,15 +1,29 @@
<script setup lang="ts">
import { ref } from 'vue'
import { ref, watch } from 'vue'
const text = ref<string | null>(null)
interface Props {
modelValue?: string | null
}
const props = withDefaults(defineProps<Props>(), { modelValue: null })
const emit = defineEmits<{ 'update:modelValue': [value: string | null] }>()
const text = ref(props.modelValue)
watch(
() => props.modelValue,
(value) => {
text.value = value
},
)
function onSearch() {
console.log('onSearch', text.value)
emit('update:modelValue', text.value || null)
}
function onClear() {
text.value = ''
console.log('onClear', text.value)
text.value = null
emit('update:modelValue', null)
}
</script>