43 lines
1012 B
Vue
43 lines
1012 B
Vue
<!-- 列表工具栏多功能检索框(漏斗切换由 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>
|