diff --git a/.env.development b/.env.development index 6bbcda6..d6a5e2c 100644 --- a/.env.development +++ b/.env.development @@ -13,5 +13,7 @@ VITE_GLOB_API_URL= # 接口前缀 VITE_GLOB_API_URL_PREFIX=/server +# 虚拟控制台 +VITE_V_CONSOLE=true diff --git a/.env.production b/.env.production index 5e25a52..fdfc2b2 100644 --- a/.env.production +++ b/.env.production @@ -11,6 +11,9 @@ VITE_GLOB_API_URL_PREFIX = /api # 是否删除console VITE_DROP_CONSOLE=true +# 虚拟控制台 +VITE_V_CONSOLE=false + # 是否启用gzip压缩或brotli压缩, 可选: gzip | brotli | none, 如果你需要多种形式,你可以用','来分隔 VITE_BUILD_COMPRESS='none' diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 7e565f8..0d71aa1 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -1,14 +1,15 @@ +import * as path from 'node:path' import type { PluginOption } from 'vite' import Components from 'unplugin-vue-components/vite' import { VantResolver } from 'unplugin-vue-components/resolvers' import vue from '@vitejs/plugin-vue' import UnoCSS from 'unocss/vite' import AutoImport from 'unplugin-auto-import/vite' +import { viteVConsole } from 'vite-plugin-vconsole' import { configHtmlPlugin } from './html' import { configCompressPlugin } from './compress' import { configVisualizerConfig } from './visualizer' import { configSvgIconsPlugin } from './svgSprite' - /** * 配置 vite 插件 * @param viteEnv vite 环境变量配置文件键值队 object @@ -26,6 +27,13 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { const vitePlugins: (PluginOption | PluginOption[])[] = [ // have to vue(), + viteVConsole({ + entry: path.resolve('src/main.ts'), // 或者可以使用这个配置: [path.resolve('src/main.ts')] + enabled: viteEnv.VITE_V_CONSOLE, // 可自行结合 mode 和 command 进行判断 + config: { + theme: 'dark', + }, + }), // 按需引入VantUi且自动创建组件声明 Components({ dts: true, diff --git a/index.html b/index.html index e0099b1..a93e310 100644 --- a/index.html +++ b/index.html @@ -10,14 +10,15 @@
diff --git a/src/views/daxpay/channel/wechat/WechatAuthCallback.vue b/src/views/daxpay/channel/wechat/WechatAuthCallback.vue index 15d4a4a..333783f 100644 --- a/src/views/daxpay/channel/wechat/WechatAuthCallback.vue +++ b/src/views/daxpay/channel/wechat/WechatAuthCallback.vue @@ -1,12 +1,19 @@ diff --git a/types/global.d.ts b/types/global.d.ts index 9edc09a..3fa51b6 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -61,6 +61,7 @@ declare global { VITE_GLOB_APP_TITLE: string VITE_GLOB_APP_SHORT_NAME: string VITE_DROP_CONSOLE: boolean + VITE_V_CONSOLE: boolean VITE_PROXY: [string, string][] VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none' VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean diff --git a/vite.config.ts b/vite.config.ts index 1fc4a25..57ab509 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -132,7 +132,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { server: { host: true, // 服务启动时是否自动打开浏览器 - open: true, + open: false, // 服务端口号 port: Number(VITE_PORT), proxy: createProxy(VITE_PROXY),