From 7631d6e0b6fa64a273746c5d33afe614102e5007 Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Wed, 19 Jun 2024 20:45:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20`f-select`=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9C=A8=E7=BB=91=E5=AE=9A=E5=80=BC=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E6=97=B6=E5=80=99=E6=B2=A1=E6=9C=89=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../fighting-design/select/src/select.vue | 12 ++++++++++- start/src/App.vue | 20 ++----------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9f3779f8..fd7b695aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - 修复 `f-textarea` 组件在 `resize` 不同配置项的情况下输入框错位的问题 - 优化 `f-textarea` 组件整体流程度,代码近一步优化 - `f-textarea` 组件 Enter 事件默认改为换行,ctrl + Enter 为提交事件,会执行 `on-enter` 事件 +- 修复 `f-select` 组件在绑定值为空的时候没有清空输入框的问题 ## 1.0.0-alpha.8 (2024-06-12) diff --git a/packages/fighting-design/select/src/select.vue b/packages/fighting-design/select/src/select.vue index b7bc32eb55..7c863bf79d 100644 --- a/packages/fighting-design/select/src/select.vue +++ b/packages/fighting-design/select/src/select.vue @@ -2,7 +2,7 @@ import { Props, SELECT_PROPS_TOKEN } from './props' import { FInput } from '../../input' import { useList, useRun } from '../../_hooks' - import { provide, ref, reactive, nextTick } from 'vue' + import { provide, ref, reactive, nextTick, watch } from 'vue' import { FDropdown } from '../../dropdown' import { FSvgIcon } from '../../svg-icon' import { FEmpty } from '../../empty' @@ -113,6 +113,16 @@ isFiltering.value = true } + // 如果绑定值为空了,则情清空文本框显示 + watch( + (): SelectModelValue => modelValue.value, + (newValue: SelectModelValue) => { + if (!newValue) { + inputValue.value = '' + } + } + ) + // 向子组件注入依赖项 provide( SELECT_PROPS_TOKEN, diff --git a/start/src/App.vue b/start/src/App.vue index a1cbb31181..1c772edac4 100644 --- a/start/src/App.vue +++ b/start/src/App.vue @@ -1,19 +1,3 @@ - + - +