From 372de7a4d5c98f20bfbeadfe53c1421af233fab8 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 19 Jan 2023 11:15:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E8=BF=9B=E5=85=A5=E5=8A=A0=E8=BD=BD=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/.env.base | 2 ++ yudao-ui-admin-vue3/.env.dev | 2 ++ yudao-ui-admin-vue3/.env.pro | 2 ++ yudao-ui-admin-vue3/.env.test | 2 ++ yudao-ui-admin-vue3/src/main.ts | 7 +++++++ yudao-ui-admin-vue3/src/types/auto-components.d.ts | 6 ++++++ yudao-ui-admin-vue3/src/utils/env.ts | 8 ++++++++ yudao-ui-admin-vue3/src/views/infra/swagger/index.vue | 3 ++- yudao-ui-admin-vue3/types/env.d.ts | 1 + 9 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 yudao-ui-admin-vue3/src/utils/env.ts diff --git a/yudao-ui-admin-vue3/.env.base b/yudao-ui-admin-vue3/.env.base index 7a2f2a0ff..fdb26d850 100644 --- a/yudao-ui-admin-vue3/.env.base +++ b/yudao-ui-admin-vue3/.env.base @@ -1,6 +1,8 @@ # 本地开发环境 NODE_ENV=development +VITE_DEV=true + # 请求路径 VITE_BASE_URL='http://localhost:48080' diff --git a/yudao-ui-admin-vue3/.env.dev b/yudao-ui-admin-vue3/.env.dev index a67cdc686..3b85e4819 100644 --- a/yudao-ui-admin-vue3/.env.dev +++ b/yudao-ui-admin-vue3/.env.dev @@ -1,6 +1,8 @@ # 开发环境 NODE_ENV=production +VITE_DEV=false + # 请求路径 VITE_BASE_URL='http://localhost:48080' diff --git a/yudao-ui-admin-vue3/.env.pro b/yudao-ui-admin-vue3/.env.pro index 4b47737e1..8348e02e3 100644 --- a/yudao-ui-admin-vue3/.env.pro +++ b/yudao-ui-admin-vue3/.env.pro @@ -1,6 +1,8 @@ # 生产环境 NODE_ENV=production +VITE_DEV=false + # 请求路径 VITE_BASE_URL='http://localhost:48080' diff --git a/yudao-ui-admin-vue3/.env.test b/yudao-ui-admin-vue3/.env.test index 6166840fa..85e2cf545 100644 --- a/yudao-ui-admin-vue3/.env.test +++ b/yudao-ui-admin-vue3/.env.test @@ -1,6 +1,8 @@ # 测试环境 NODE_ENV=production +VITE_DEV=false + # 请求路径 VITE_BASE_URL='http://localhost:48080' diff --git a/yudao-ui-admin-vue3/src/main.ts b/yudao-ui-admin-vue3/src/main.ts index e4511d9b1..f5e3c024e 100644 --- a/yudao-ui-admin-vue3/src/main.ts +++ b/yudao-ui-admin-vue3/src/main.ts @@ -37,6 +37,13 @@ import App from './App.vue' import './permission' +import { isDevMode } from '@/utils/env' + +if (isDevMode()) { + console.info(isDevMode()) + import('element-plus/dist/index.css') +} + // 创建实例 const setupAll = async () => { const app = createApp(App) diff --git a/yudao-ui-admin-vue3/src/types/auto-components.d.ts b/yudao-ui-admin-vue3/src/types/auto-components.d.ts index 0a56908aa..a35bc2a30 100644 --- a/yudao-ui-admin-vue3/src/types/auto-components.d.ts +++ b/yudao-ui-admin-vue3/src/types/auto-components.d.ts @@ -21,6 +21,7 @@ declare module '@vue/runtime-core' { DictTag: typeof import('./../components/DictTag/src/DictTag.vue')['default'] Echart: typeof import('./../components/Echart/src/Echart.vue')['default'] Editor: typeof import('./../components/Editor/src/Editor.vue')['default'] + ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] @@ -30,6 +31,7 @@ declare module '@vue/runtime-core' { ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] + ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] @@ -38,6 +40,7 @@ declare module '@vue/runtime-core' { ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] + ElImage: typeof import('element-plus/es')['ElImage'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] @@ -51,7 +54,10 @@ declare module '@vue/runtime-core' { ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] + ElSpace: typeof import('element-plus/es')['ElSpace'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] + ElTable: typeof import('element-plus/es')['ElTable'] + ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] diff --git a/yudao-ui-admin-vue3/src/utils/env.ts b/yudao-ui-admin-vue3/src/utils/env.ts new file mode 100644 index 000000000..4a45f6223 --- /dev/null +++ b/yudao-ui-admin-vue3/src/utils/env.ts @@ -0,0 +1,8 @@ +export const isDevMode = () => { + const dev = import.meta.env.VITE_DEV + if (dev && dev === true) { + return true + } else { + return false + } +} diff --git a/yudao-ui-admin-vue3/src/views/infra/swagger/index.vue b/yudao-ui-admin-vue3/src/views/infra/swagger/index.vue index 72a826e61..dce8122ee 100644 --- a/yudao-ui-admin-vue3/src/views/infra/swagger/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/swagger/index.vue @@ -5,5 +5,6 @@ diff --git a/yudao-ui-admin-vue3/types/env.d.ts b/yudao-ui-admin-vue3/types/env.d.ts index 33e1f40b8..81469b76d 100644 --- a/yudao-ui-admin-vue3/types/env.d.ts +++ b/yudao-ui-admin-vue3/types/env.d.ts @@ -11,6 +11,7 @@ interface ImportMetaEnv { readonly VITE_APP_TITLE: string readonly VITE_PORT: number readonly VITE_OPEN: string + readonly VITE_DEV: boolean readonly VITE_ROUTE_ALWAYSSHOW_ENABLE: string readonly VITE_APP_CAPTCHA_ENABLE: string readonly VITE_APP_TENANT_ENABLE: string From fbb154f93dadbb029c6e92146214a37b12ee51f6 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 19 Jan 2023 13:36:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20=E7=94=A8=E6=88=B7=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=A0=91=E8=B6=85=E5=87=BA=E9=AB=98=E5=BA=A6=E5=90=8E?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/types/auto-components.d.ts | 1 + .../src/views/system/user/index.vue | 28 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/yudao-ui-admin-vue3/src/types/auto-components.d.ts b/yudao-ui-admin-vue3/src/types/auto-components.d.ts index a35bc2a30..46a1ae56c 100644 --- a/yudao-ui-admin-vue3/src/types/auto-components.d.ts +++ b/yudao-ui-admin-vue3/src/types/auto-components.d.ts @@ -51,6 +51,7 @@ declare module '@vue/runtime-core' { ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] + ElScroll: typeof import('element-plus/es')['ElScroll'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] diff --git a/yudao-ui-admin-vue3/src/views/system/user/index.vue b/yudao-ui-admin-vue3/src/views/system/user/index.vue index 971db66dc..d125112de 100644 --- a/yudao-ui-admin-vue3/src/views/system/user/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/user/index.vue @@ -8,17 +8,19 @@ - + + +