fix: ESC后搜索框内容不清空的问题

This commit is contained in:
ZiuChen 2022-08-15 18:10:05 +08:00
parent 2a454983fd
commit 069675f7c3

View File

@ -6,15 +6,21 @@
<script setup> <script setup>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
const filterText = ref('')
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
type: String, type: String,
required: true required: true
} }
}) })
const filterText = ref('')
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
// filterText modelValue
watch(filterText, (val) => emit('update:modelValue', val)) watch(filterText, (val) => emit('update:modelValue', val))
// modelValue filterText
watch(
() => props.modelValue,
(val) => (filterText.value = val)
)
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>