perf: support double click to modify match keyword #149

This commit is contained in:
Lykin 2024-02-14 14:44:54 +08:00
parent c0415fe23d
commit e1f022908c
1 changed files with 15 additions and 3 deletions

View File

@ -68,6 +68,11 @@ const onClearFilter = () => {
onClearMatch() onClearMatch()
} }
const onUpdateMatch = () => {
inputData.filter = inputData.match
onClearMatch()
}
const onClearMatch = () => { const onClearMatch = () => {
const changed = !isEmpty(inputData.match) const changed = !isEmpty(inputData.match)
inputData.match = '' inputData.match = ''
@ -97,9 +102,9 @@ defineExpose({
@keyup.enter="onKeyup"> @keyup.enter="onKeyup">
<template #prefix> <template #prefix>
<slot name="prefix" /> <slot name="prefix" />
<n-tooltip v-if="hasMatch"> <n-tooltip v-if="hasMatch" placement="bottom">
<template #trigger> <template #trigger>
<n-tag closable size="small" @close="onClearMatch"> <n-tag closable size="small" @close="onClearMatch" @dblclick="onUpdateMatch">
{{ inputData.match }} {{ inputData.match }}
</n-tag> </n-tag>
</template> </template>
@ -141,4 +146,11 @@ defineExpose({
</n-input-group> </n-input-group>
</template> </template>
<style lang="scss" scoped></style> <style lang="scss" scoped>
//:deep(.n-input__prefix) {
// max-width: 50%;
//}
//:deep(.n-tag__content) {
// overflow: hidden;
//}
</style>