Skip to content

Commit

Permalink
feat: 增加禁用开发者工具环境变量
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Jun 26, 2024
1 parent 104154e commit 306f357
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
VITE_APP_API_BASEURL = /
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VITE_APP_DEBUG_TOOL =
# 是否禁用开发者工具,可防止被调试
VITE_APP_DISABLE_DEVTOOL = false

# 是否开启代理
VITE_OPEN_PROXY = false
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
VITE_APP_API_BASEURL = /
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VITE_APP_DEBUG_TOOL =
# 是否禁用开发者工具,可防止被调试
VITE_APP_DISABLE_DEVTOOL = false

# 是否在打包时启用 Mock
VITE_BUILD_MOCK = false
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
VITE_APP_API_BASEURL = /
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VITE_APP_DEBUG_TOOL =
# 是否禁用开发者工具,可防止被调试
VITE_APP_DISABLE_DEVTOOL = false

# 是否在打包时启用 Mock
VITE_BUILD_MOCK = true
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@vueuse/integrations": "^10.10.0",
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"disable-devtool": "^0.3.7",
"element-plus": "^2.7.4",
"eruda": "^3.0.1",
"floating-vue": "5.2.2",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import eruda from 'eruda'
import VConsole from 'vconsole'
import DisableDevtool from 'disable-devtool'
import hotkeys from 'hotkeys-js'
import eventBus from './utils/eventBus'
import Provider from './ui-provider/index.vue'
Expand Down Expand Up @@ -40,6 +41,7 @@ onMounted(() => {
import.meta.env.VITE_APP_DEBUG_TOOL === 'eruda' && eruda.init()
import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()
import.meta.env.VITE_APP_DISABLE_DEVTOOL === 'true' && DisableDevtool()
</script>

<template>
Expand Down

0 comments on commit 306f357

Please sign in to comment.