Skip to content

Commit

Permalink
feat(Option): optimize flashing issue when selected
Browse files Browse the repository at this point in the history
  • Loading branch information
jxzho committed Jun 14, 2024
1 parent 67a3493 commit 22abe13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions packages/fighting-design/option/src/option.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
const parentInject: SelectProvide | null = inject(SELECT_PROPS_TOKEN, null)
/** 获取到 trigger 注入的依赖项 */
const triggerInject: TriggerProvide | null = inject(TRIGGER_CLOSE_KEY, null)
/** 获取插槽内容 */
const slotLabel = computed((): string => {
if (!slot.default) {
Expand All @@ -46,10 +46,17 @@
if (!parentInject) {
return false
}
// Trigger 展示状态高优先级
if (!triggerInject?.isVisible()) {
return false
}
// 在过滤属性存在并且是正在输入中,执行过滤操作
if (parentInject.filter && parentInject.isFiltering && currentLabel) {
return currentLabel.toString().includes(parentInject.inputValue)
if (parentInject.filter || parentInject.isFiltering) {
return currentLabel
? currentLabel.toString().includes(parentInject.inputValue)
: false
}
return true
Expand Down
4 changes: 2 additions & 2 deletions packages/fighting-design/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
inputValue,
isFiltering,
onBeforeChange: prop.onBeforeChange,
modelValue: toRef(prop, 'modelValue'),
filter: toRef(prop, 'filter')
modelValue,
filter: prop.filter
})
)
</script>
Expand Down

0 comments on commit 22abe13

Please sign in to comment.