Skip to content

Commit 1e3d57d

Browse files
committed
优化:搜索触发时机,避免异常闪烁
1 parent 64ef178 commit 1e3d57d

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ window.__page.onPluginInit((data: {
5454
manager.setSubInput({
5555
placeholder: '',
5656
isFocus: false,
57+
isVisible: false,
5758
})
5859
manager.setSubInputValue('')
5960
mainSearch.value?.focus()

src/pages/Main/Lib/entryListener.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const EntryListener = {
1212
isFastPanel?: boolean,
1313
}) => {
1414

15+
// console.log('EntryListener.prepareSearch', option)
1516
option = Object.assign({
1617
isPaste: false,
1718
isFastPanel: false,
@@ -21,7 +22,7 @@ export const EntryListener = {
2122

2223
// 清除搜索框
2324
if (manager.searchValue) {
24-
// 如果10分钟未变化,清空搜索框
25+
// 如果10分钟未变化,清空搜索框,避免弹出对话框是上一次的搜索内容
2526
if (manager.searchValueUpdateTimestamp > 0 && manager.searchValueUpdateTimestamp < TimeUtil.timestamp() - 10 * 60) {
2627
manager.searchValue = ''
2728
}

src/pages/Main/MainResult.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@
8484
<div class="item" v-for="(a,aIndex) in showHistoryActions"
8585
:class="{active: activeActionGroup === 'history' && actionActionIndex === aIndex}">
8686
<ResultItem :action="a" @open="doOpenAction(a)"
87-
:show-pin="!a.runtime?.isPined" @pin="doPinToggle(a)"
88-
show-delete @delete="doHistoryDelete(a)"/>
87+
:show-pin="!a.runtime?.isPined"
88+
@pin="doPinToggle(a)"
89+
show-delete
90+
@delete="doHistoryDelete(a)"/>
8991
</div>
9092
</div>
9193
</div>

src/pages/Main/MainSearch.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
ref="mainInput"
5555
size="large"
5656
@input="(e) => onSearchValueChange(e)"
57-
@focus="onFocus"
5857
@blur="onBlur"
5958
@dblclick="onSearchDoubleClick"
6059
:model-value="manager.searchValue">
@@ -156,22 +155,18 @@ const onSearchValueChange = (value: string) => {
156155
157156
const onShow = () => {
158157
mainInput.value.focus();
158+
EntryListener.prepareSearch({}).then();
159159
};
160160
161161
const focus = () => {
162162
mainInput.value.focus();
163+
EntryListener.prepareSearch({}).then();
163164
};
164165
165166
const doLogoClick = () => {
166167
window.focusany.redirect(['system', 'page-setting'])
167168
}
168169
169-
const onFocus = () => {
170-
if (!manager.activePlugin) {
171-
EntryListener.prepareSearch({}).then()
172-
}
173-
}
174-
175170
const onBlur = () => {
176171
setTimeout(() => {
177172
mainInput.value.focus();

0 commit comments

Comments
 (0)