1
This commit is contained in:
@@ -40,11 +40,13 @@ const props = withDefaults(defineProps<{
|
||||
searchText?: string
|
||||
resetText?: string
|
||||
searchOnReset?: boolean
|
||||
searchOnClear?: boolean
|
||||
loading?: boolean
|
||||
}>(), {
|
||||
searchText: '查询',
|
||||
resetText: '重置',
|
||||
searchOnReset: true,
|
||||
searchOnClear: true,
|
||||
loading: false,
|
||||
})
|
||||
|
||||
@@ -146,6 +148,10 @@ function search() {
|
||||
emit('search', model.value)
|
||||
}
|
||||
|
||||
function clearInput() {
|
||||
if (props.searchOnClear) search()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
if (props.loading) return
|
||||
for (const field of props.fields) model.value[field.key] = resetValue(field)
|
||||
@@ -182,7 +188,7 @@ defineExpose({ search, reset })
|
||||
clearable
|
||||
v-bind="field.props"
|
||||
@update:model-value="updateField(field.key, $event)"
|
||||
@clear="search"
|
||||
@clear="clearInput"
|
||||
@keyup.enter.exact="searchFromTextInput"
|
||||
>
|
||||
<template #prefix><Search :size="16" /></template>
|
||||
|
||||
Reference in New Issue
Block a user