From 05019837d058f7aae1961f3908e6efa3eace8626 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 4 Apr 2023 22:08:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8vue3+vite3=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=B8=AD=E4=BD=BF=E7=94=A8=E9=A1=B6=E5=B1=82?= =?UTF-8?q?await=E6=89=93=E5=8C=85=E7=9A=84=E6=97=B6=E5=80=99=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/index.ts | 9 ++++++++- package.json | 1 + src/types/auto-components.d.ts | 8 ++++++++ src/views/system/mail/template/form.vue | 10 ++++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/build/vite/index.ts b/build/vite/index.ts index fa7e04e8..7d3aa5be 100644 --- a/build/vite/index.ts +++ b/build/vite/index.ts @@ -12,6 +12,7 @@ import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import viteCompression from 'vite-plugin-compression' +import topLevelAwait from 'vite-plugin-top-level-await' import vueSetupExtend from 'vite-plugin-vue-setup-extend' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' @@ -96,6 +97,12 @@ export function createVitePlugins() { ext: '.gz', // 生成的压缩包后缀 deleteOriginFile: false //压缩后是否删除源文件 }), - ViteEjsPlugin() + ViteEjsPlugin(), + topLevelAwait({ + // The export name of top-level await promise for each chunk module + promiseExportName: '__tla', + // The function to generate import names of top-level await promise in each chunk module + promiseImportName: (i) => `__tla_${i}` + }) ] } diff --git a/package.json b/package.json index 683d09eb..b7629029 100644 --- a/package.json +++ b/package.json @@ -122,6 +122,7 @@ "vite-plugin-progress": "^0.0.6", "vite-plugin-purge-icons": "^0.9.2", "vite-plugin-svg-icons": "^2.0.1", + "vite-plugin-top-level-await": "^1.3.0", "vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-windicss": "^1.8.10", "vue-tsc": "^1.2.0", diff --git a/src/types/auto-components.d.ts b/src/types/auto-components.d.ts index 0ed1a84d..8851767a 100644 --- a/src/types/auto-components.d.ts +++ b/src/types/auto-components.d.ts @@ -23,6 +23,8 @@ 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'] + ElAutoResizer: typeof import('element-plus/es')['ElAutoResizer'] + ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElButton: typeof import('element-plus/es')['ElButton'] ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] @@ -52,6 +54,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'] @@ -60,17 +63,22 @@ declare module '@vue/runtime-core' { ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] 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'] + ElTableV2: typeof import('element-plus/es')['ElTableV2'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] + ElTimeline: typeof import('element-plus/es')['ElTimeline'] + ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] diff --git a/src/views/system/mail/template/form.vue b/src/views/system/mail/template/form.vue index f1b8f9a2..96989e3a 100644 --- a/src/views/system/mail/template/form.vue +++ b/src/views/system/mail/template/form.vue @@ -1,5 +1,11 @@