This commit is contained in:
wujinliang
2026-08-27 21:48:15 +08:00
parent 550d8add97
commit b47323edf3
53 changed files with 624 additions and 82 deletions
+7 -1
View File
@@ -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>