feat(SearchInp): 支持搜索词同步#886
Conversation
Summary of ChangesHello @MoYingJi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在增强应用程序中搜索框的用户体验和灵活性。通过将单一的“失焦自动清空”设置项扩展为一个更全面的“搜索框行为”设置,引入了“同步搜索词”模式。这意味着用户现在可以选择在搜索框失去焦点时保留搜索词、清空搜索词,或者在导航到搜索页面时自动同步页面上的搜索关键词,从而提供更智能和个性化的搜索交互。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| const syncSearchInput = () => { | ||
| // 如果当前是搜索页,则同步搜索页的搜索词到搜索框,如果是其他页面,则清空搜索框 | ||
| if (String(route.name).startsWith("search") && route.query.keyword) { | ||
| statusStore.searchInputValue = String(route.query.keyword); |
There was a problem hiding this comment.
There was a problem hiding this comment.
Pull request overview
This PR enhances the search input behavior by expanding the boolean clearSearchOnBlur setting into an enum-based searchInputBehavior setting with three modes: "normal" (retain search term), "clear" (clear on blur), and "sync" (synchronize with current page's search term).
Changes:
- Replaced boolean
clearSearchOnBlursetting with enumsearchInputBehaviorsupporting three modes - Added migration logic to convert existing user settings from boolean to enum
- Implemented "sync" mode that keeps the search input synchronized with the current route's search keyword
- Updated settings UI from a switch to a select dropdown with three options
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/stores/setting.ts | Updated setting type definition and default value from boolean to enum |
| src/stores/migrations/settingMigrations.ts | Added migration v10 to convert old boolean setting to new enum |
| src/components/Setting/config/general.ts | Changed UI control from switch to select with three mode options |
| src/components/Search/SearchInp.vue | Implemented sync logic with route watcher and updated blur/search behavior handling |
将
clearSearchOnBlur设置项扩充为searchInputBehavior,保留原有的normal和clear模式,增加了sync模式(如果当前是搜索页,则同步搜索页的搜索词到搜索框,如果是其他页面,则清空搜索框)