Skip to content

Commit 306f357

Browse files
committed
feat: 增加禁用开发者工具环境变量
1 parent 104154e commit 306f357

File tree

6 files changed

+17
-0
lines changed

6 files changed

+17
-0
lines changed

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
66
VITE_APP_API_BASEURL = /
77
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
88
VITE_APP_DEBUG_TOOL =
9+
# 是否禁用开发者工具,可防止被调试
10+
VITE_APP_DISABLE_DEVTOOL = false
911

1012
# 是否开启代理
1113
VITE_OPEN_PROXY = false

.env.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
66
VITE_APP_API_BASEURL = /
77
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
88
VITE_APP_DEBUG_TOOL =
9+
# 是否禁用开发者工具,可防止被调试
10+
VITE_APP_DISABLE_DEVTOOL = false
911

1012
# 是否在打包时启用 Mock
1113
VITE_BUILD_MOCK = false

.env.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ VITE_APP_TITLE = One-step-admin 基础版
66
VITE_APP_API_BASEURL = /
77
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
88
VITE_APP_DEBUG_TOOL =
9+
# 是否禁用开发者工具,可防止被调试
10+
VITE_APP_DISABLE_DEVTOOL = false
911

1012
# 是否在打包时启用 Mock
1113
VITE_BUILD_MOCK = true

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@vueuse/integrations": "^10.10.0",
2929
"axios": "^1.7.2",
3030
"dayjs": "^1.11.11",
31+
"disable-devtool": "^0.3.7",
3132
"element-plus": "^2.7.4",
3233
"eruda": "^3.0.1",
3334
"floating-vue": "5.2.2",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import eruda from 'eruda'
33
import VConsole from 'vconsole'
4+
import DisableDevtool from 'disable-devtool'
45
import hotkeys from 'hotkeys-js'
56
import eventBus from './utils/eventBus'
67
import Provider from './ui-provider/index.vue'
@@ -40,6 +41,7 @@ onMounted(() => {
4041
4142
import.meta.env.VITE_APP_DEBUG_TOOL === 'eruda' && eruda.init()
4243
import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()
44+
import.meta.env.VITE_APP_DISABLE_DEVTOOL === 'true' && DisableDevtool()
4345
</script>
4446

4547
<template>

0 commit comments

Comments
 (0)