Skip to content

Commit

Permalink
refactor!: 应用配置 app.enableAppSetting 迁移到环境变量文件中
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Dec 17, 2023
1 parent dc17038 commit 8311afa
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 应用配置面板
VITE_APP_SETTING = true
# 页面标题
VITE_APP_TITLE = Fantastic-admin 基础版
# 接口请求地址,会设置到 axios 的 baseURL 参数上
Expand Down
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 应用配置面板
VITE_APP_SETTING = false
# 页面标题
VITE_APP_TITLE = 页面标题
# 接口请求地址,会设置到 axios 的 baseURL 参数上
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 应用配置面板
VITE_APP_SETTING = false
# 页面标题
VITE_APP_TITLE = 页面标题(test)
# 接口请求地址,会设置到 axios 的 baseURL 参数上
Expand Down
4 changes: 3 additions & 1 deletion src/layouts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ onUnmounted(() => {
hotkeys.unbind('f5')
hotkeys.unbind('alt+`')
})
const enableAppSetting = import.meta.env.VITE_APP_SETTING === 'true'
</script>

<template>
Expand Down Expand Up @@ -97,7 +99,7 @@ onUnmounted(() => {
</div>
<Search />
<HotkeysIntro />
<template v-if="settingsStore.settings.app.enableAppSetting">
<template v-if="enableAppSetting">
<div class="app-setting" @click="eventBus.emit('global-app-setting-toggle')">
<SvgIcon name="uiw:setting-o" class="icon" />
</div>
Expand Down
1 change: 0 additions & 1 deletion src/settings.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const globalSettingsDefault: RecursiveRequired<Settings.all> = {
enableProgress: true,
enableDynamicTitle: false,
routeBaseOn: 'frontend',
enableAppSetting: false,
},
home: {
enable: true,
Expand Down
5 changes: 0 additions & 5 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ declare namespace Settings {
* @可选值 `'filesystem'` 文件系统
*/
routeBaseOn?: 'frontend' | 'backend' | 'filesystem'
/**
* 是否开启应用配置,强烈建议在生产环境中关闭
* @默认值 `false`
*/
enableAppSetting?: boolean
}
interface home {
/**
Expand Down

0 comments on commit 8311afa

Please sign in to comment.