Skip to content

Commit 78a73d1

Browse files
committed
fix: Select 选项后 trigger 误触发与 popup 分类过滤无法清空
button 模式下用 mousedown 触发 selectOption + close,但 sp-fade leave 0.15s 中如果用户 click 持续超过 transition 时长,mouseup 会落到下方 trigger button 上、触发 toggle 重新打开下拉。给 toggle/toggleFromInput 加 250ms suppression 窗口,selectOption 后短时间内 trigger 的 click 被忽略。popup 的分类过滤 categoryFilterValue 是 computed v-model,setter 用 if (value && ...) 把空字符串过滤掉,X 发出的清空指令永远到不了 state.activeCategory,导致 X 看似无反应;改为空值时回到 FOCUS_CATEGORY。将版本号提升到 1.2.95。
1 parent 9c8c335 commit 78a73d1

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stackprism",
33
"private": true,
4-
"version": "1.2.94",
4+
"version": "1.2.95",
55
"type": "module",
66
"description": "StackPrism 用于检测网页前端、后端、CDN、SaaS、广告营销、统计、登录、支付、网站程序和主题模板线索。",
77
"scripts": {

src/ui/components/Select.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
const inputRef = ref<HTMLInputElement | null>(null)
111111
const listRef = ref<HTMLUListElement | null>(null)
112112
const selectRef = ref<HTMLDivElement | null>(null)
113+
let suppressTriggerUntil = 0
113114
114115
const selectedLabel = computed(() => {
115116
const matched = props.options.find(o => o.value === props.modelValue)
@@ -148,11 +149,13 @@
148149
}
149150
150151
const toggle = () => {
152+
if (Date.now() < suppressTriggerUntil) return
151153
if (isOpen.value) close()
152154
else open()
153155
}
154156
155157
const toggleFromInput = () => {
158+
if (Date.now() < suppressTriggerUntil) return
156159
if (isOpen.value) {
157160
close()
158161
} else {
@@ -164,6 +167,7 @@
164167
const selectOption = (value: string) => {
165168
emit('update:modelValue', value)
166169
close()
170+
suppressTriggerUntil = Date.now() + 250
167171
if (props.creatable) inputRef.value?.focus()
168172
else triggerRef.value?.focus()
169173
}

src/ui/popup/Popup.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,11 @@
521521
return cat
522522
},
523523
set: value => {
524-
if (value && value !== FOCUS_CATEGORY && value !== '全部') {
524+
if (!value) {
525+
state.activeCategory = FOCUS_CATEGORY
526+
return
527+
}
528+
if (value !== FOCUS_CATEGORY && value !== '全部') {
525529
state.activeCategory = value
526530
}
527531
}

0 commit comments

Comments
 (0)