Skip to content

Commit 75455b0

Browse files
t8y2honghuangdc
authored andcommitted
feat(theme): global search button toggle
- 在主题设置中添加全局搜索按钮的显示控制选项 - 更新多语言文件,添加全局搜索按钮显示控制的翻译 - 修改全局头部组件,根据主题设置决定是否显示全局搜索按钮 - 在主题抽屉中添加全局搜索按钮显示控制的开关
1 parent dfb647a commit 75455b0

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

src/layouts/modules/global-header/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const { isFullscreen, toggle } = useFullscreen();
3838
<GlobalBreadcrumb v-if="!appStore.isMobile" class="ml-12px" />
3939
</div>
4040
<div class="h-full flex-y-center justify-end">
41-
<GlobalSearch />
41+
<GlobalSearch v-if="themeStore.header.globalSearch.visible" />
4242
<FullScreen v-if="!appStore.isMobile" :full="isFullscreen" @click="toggle" />
4343
<LangSwitch
4444
v-if="themeStore.header.multilingual.visible"

src/layouts/modules/theme-drawer/modules/page-fun.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
130130
<SettingItem key="9" :label="$t('theme.header.multilingual.visible')">
131131
<NSwitch v-model:value="themeStore.header.multilingual.visible" />
132132
</SettingItem>
133+
<SettingItem key="10" :label="$t('theme.header.globalSearch.visible')">
134+
<NSwitch v-model:value="themeStore.header.globalSearch.visible" />
135+
</SettingItem>
133136
</TransitionGroup>
134137
</template>
135138

src/locales/langs/en-us.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const local: App.I18n.Schema = {
112112
},
113113
multilingual: {
114114
visible: 'Display multilingual button'
115+
},
116+
globalSearch: {
117+
visible: 'Display GlobalSearch button'
115118
}
116119
},
117120
tab: {

src/locales/langs/zh-cn.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const local: App.I18n.Schema = {
112112
},
113113
multilingual: {
114114
visible: '显示多语言按钮'
115+
},
116+
globalSearch: {
117+
visible: '显示全局搜索按钮'
115118
}
116119
},
117120
tab: {

src/theme/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export const themeSettings: App.Theme.ThemeSetting = {
3030
},
3131
multilingual: {
3232
visible: true
33+
},
34+
globalSearch: {
35+
visible: true
3336
}
3437
},
3538
tab: {

src/typings/app.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ declare namespace App {
5858
/** Whether to show the multilingual */
5959
visible: boolean;
6060
};
61+
globalSearch: {
62+
/** Whether to show the GlobalSearch */
63+
visible: boolean;
64+
};
6165
};
6266
/** Tab */
6367
tab: {
@@ -377,6 +381,9 @@ declare namespace App {
377381
multilingual: {
378382
visible: string;
379383
};
384+
globalSearch: {
385+
visible: string;
386+
};
380387
};
381388
tab: {
382389
visible: string;

0 commit comments

Comments
 (0)