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 9e444c8 commit 90b5880
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 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 = Fantastic-admin 基础版
VITE_APP_API_BASEURL = /
# 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
VITE_APP_DEBUG_TOOL =
# 是否禁用开发者工具,可防止被调试
VITE_APP_DISABLE_DEVTOOL = false

# 是否开启代理
VITE_OPEN_PROXY = false
Expand Down
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 = 页面标题
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 = 页面标题(test)
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 @@ -30,6 +30,7 @@
"axios": "^1.7.2",
"dayjs": "^1.11.11",
"defu": "^6.1.4",
"disable-devtool": "^0.3.7",
"element-plus": "^2.7.5",
"eruda": "^3.0.1",
"floating-vue": "5.2.2",
Expand Down
20 changes: 11 additions & 9 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 @@ -64,6 +65,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 90b5880

Please sign in to comment.