feat: ✨ 环境变量启用server
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -75,7 +75,6 @@ web_modules/
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
@@ -19,8 +19,10 @@ export function useMounted(tipDialog: Ref<any>) {
|
||||
const tipDesc = ref('')
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const { data } = useWebsocket()
|
||||
const msgListDb = new IndexDb('msgList', ['msgList'], 1, ['createTime'])
|
||||
const enableWebsocket = import.meta.env.VITE_ENABLE_WEBSOCKET
|
||||
const websocketData = enableWebsocket === 'true' ? useWebsocket() : { data: ref(null) }
|
||||
const { data } = websocketData
|
||||
// 设置当前奖列表
|
||||
function setCurrentPrize() {
|
||||
if (prizeList.value.length <= 0) {
|
||||
|
||||
@@ -106,6 +106,7 @@ export const configRoutes = {
|
||||
name: 'Server',
|
||||
component: () => import('@/views/Config/Server/index.vue'),
|
||||
meta: {
|
||||
hidden: import.meta.env.VITE_ENABLE_WEBSOCKET !== 'true',
|
||||
title: i18n.global.t('sidebar.server'),
|
||||
icon: 'server',
|
||||
},
|
||||
|
||||
@@ -37,7 +37,7 @@ function skip(path: string) {
|
||||
<div class="flex min-h-[calc(100%-280px)]">
|
||||
<ul class="w-56 m-0 mr-3 min-w-56 menu bg-base-200 pt-14">
|
||||
<li v-for="item in menuList" :key="item.name">
|
||||
<details v-if="item.children" open>
|
||||
<details v-if="item.children && !item.meta.hidden" open>
|
||||
<summary>{{ item.meta.title }}</summary>
|
||||
<ul>
|
||||
<li v-for="subItem in item.children" :key="subItem.name">
|
||||
@@ -62,9 +62,10 @@ function skip(path: string) {
|
||||
</ul>
|
||||
</details>
|
||||
<a
|
||||
v-else :style="item.name === route.name ? 'background-color:rgba(12,12,12,0.2)' : ''"
|
||||
v-else-if="!item.meta.hidden" :style="item.name === route.name ? 'background-color:rgba(12,12,12,0.2)' : ''"
|
||||
@click="skip(item.path)"
|
||||
>{{ item.meta!.title }}</a>
|
||||
<div v-else />
|
||||
</li>
|
||||
</ul>
|
||||
<router-view class="flex-1 mt-5" />
|
||||
|
||||
Reference in New Issue
Block a user