Files
shanxia2.0/web-admin/src/components/business/list-quick-search-input/index.vue
T
2026-07-11 17:15:17 +08:00

43 lines
1012 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 列表工具栏多功能检索框(漏斗切换由 filter-collapse 注入到 .quick-search-group) -->
<template>
<el-input
:model-value="modelValue"
class="quick-search-input"
:placeholder="placeholder"
clearable
@update:model-value="emit('update:modelValue', $event ?? '')"
@keyup.enter="emit('search')"
@clear="emit('clear')"
>
<template #suffix>
<el-icon class="quick-search-icon" @click="emit('search')"><Search /></el-icon>
</template>
</el-input>
</template>
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import { watchDebounced } from '@vueuse/core'
defineOptions({ name: 'ListQuickSearchInput' })
const props = defineProps<{
modelValue: string
placeholder: string
}>()
const emit = defineEmits<{
'update:modelValue': [value: string]
search: []
clear: []
}>()
watchDebounced(
() => props.modelValue,
() => {
emit('search')
},
{ debounce: 300 }
)
</script>