chore: 添加打包进度条

This commit is contained in:
xingyu4j 2022-11-23 13:27:18 +08:00
parent bf12cb89df
commit 11770292bb
4 changed files with 45 additions and 7 deletions

View File

@ -38,8 +38,8 @@
"echarts-wordcloud": "^2.0.0",
"element-plus": "2.2.21",
"intro.js": "^6.0.0",
"jsencrypt": "^3.3.1",
"js-cookie": "^3.0.1",
"jsencrypt": "^3.3.1",
"lodash-es": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
@ -98,6 +98,7 @@
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-progress": "^0.0.6",
"vite-plugin-purge-icons": "^0.9.1",
"vite-plugin-style-import": "2.0.0",
"vite-plugin-svg-icons": "^2.0.1",

View File

@ -64,6 +64,7 @@ specifiers:
vite-plugin-compression: ^0.5.1
vite-plugin-eslint: ^1.8.1
vite-plugin-html: ^3.2.0
vite-plugin-progress: ^0.0.6
vite-plugin-purge-icons: ^0.9.1
vite-plugin-style-import: 2.0.0
vite-plugin-svg-icons: ^2.0.1
@ -153,6 +154,7 @@ devDependencies:
vite-plugin-compression: registry.npmmirror.com/vite-plugin-compression/0.5.1_vite@3.2.4
vite-plugin-eslint: registry.npmmirror.com/vite-plugin-eslint/1.8.1_eslint@8.28.0+vite@3.2.4
vite-plugin-html: registry.npmmirror.com/vite-plugin-html/3.2.0_vite@3.2.4
vite-plugin-progress: registry.npmmirror.com/vite-plugin-progress/0.0.6_vite@3.2.4
vite-plugin-purge-icons: registry.npmmirror.com/vite-plugin-purge-icons/0.9.1_vite@3.2.4
vite-plugin-style-import: registry.npmmirror.com/vite-plugin-style-import/2.0.0_vite@3.2.4
vite-plugin-svg-icons: registry.npmmirror.com/vite-plugin-svg-icons/2.0.1_vite@3.2.4
@ -1245,6 +1247,12 @@ packages:
version: 1.2.2
dev: true
registry.npmmirror.com/@types/node/10.17.60:
resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@types/node/-/node-10.17.60.tgz}
name: '@types/node'
version: 10.17.60
dev: true
registry.npmmirror.com/@types/node/14.18.33:
resolution: {integrity: sha512-qelS/Ra6sacc4loe/3MSjXNL1dNQ/GjxNHVzuChwMfmk7HuycRLVQN2qNY3XahK+fZc5E2szqQSKUyAF0E+2bg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@types/node/-/node-14.18.33.tgz}
name: '@types/node'
@ -6995,6 +7003,13 @@ packages:
engines: {node: '>=6'}
dev: false
registry.npmmirror.com/progress/2.0.3:
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/progress/-/progress-2.0.3.tgz}
name: progress
version: 2.0.3
engines: {node: '>=0.4.0'}
dev: true
registry.npmmirror.com/proxy-from-env/1.1.0:
resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz}
name: proxy-from-env
@ -7081,6 +7096,14 @@ packages:
engines: {node: '>=8'}
dev: true
registry.npmmirror.com/rd/2.0.1:
resolution: {integrity: sha512-/XdKU4UazUZTXFmI0dpABt8jSXPWcEyaGdk340KdHnsEOdkTctlX23aAK7ChQDn39YGNlAJr1M5uvaKt4QnpNw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/rd/-/rd-2.0.1.tgz}
name: rd
version: 2.0.1
dependencies:
'@types/node': registry.npmmirror.com/@types/node/10.17.60
dev: true
registry.npmmirror.com/read-pkg-up/7.0.1:
resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz}
name: read-pkg-up
@ -8511,6 +8534,21 @@ packages:
vite: registry.npmmirror.com/vite/3.2.4_mp5lu76ee5qtwstsyca37sdhqi
dev: true
registry.npmmirror.com/vite-plugin-progress/0.0.6_vite@3.2.4:
resolution: {integrity: sha512-pIK2TVEY4XFGrz10CQDdEufBBCDaV0geRHfXV3abGTBr+OF9O0Zmd3ZDrHJXDv4Rl3qAQP4BTCuPYQ3XqstmqA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/vite-plugin-progress/-/vite-plugin-progress-0.0.6.tgz}
id: registry.npmmirror.com/vite-plugin-progress/0.0.6
name: vite-plugin-progress
version: 0.0.6
engines: {node: '>=14', pnpm: '>=7.0.0'}
peerDependencies:
vite: '>2.0.0-0'
dependencies:
picocolors: registry.npmmirror.com/picocolors/1.0.0
progress: registry.npmmirror.com/progress/2.0.3
rd: registry.npmmirror.com/rd/2.0.1
vite: registry.npmmirror.com/vite/3.2.4_mp5lu76ee5qtwstsyca37sdhqi
dev: true
registry.npmmirror.com/vite-plugin-purge-icons/0.9.1_vite@3.2.4:
resolution: {integrity: sha512-oS0Y9Iq6vGnTDVRzB8xJNhA/gGlyR0lfCICU6+9FRKdrO5PnT34fRjvd8YWEsegCrk91+w3GVZc0HJDj/dPp5Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/vite-plugin-purge-icons/-/vite-plugin-purge-icons-0.9.1.tgz}
id: registry.npmmirror.com/vite-plugin-purge-icons/0.9.1

View File

@ -5,11 +5,9 @@ const props = defineProps({
src: propTypes.string.def('')
})
const loading = ref(true)
const frameSrc = ref<string>('')
const height = ref('')
const frameRef = ref<HTMLElement | null>(null)
const init = () => {
frameSrc.value = props.src
height.value = document.documentElement.clientHeight - 94.5 + 'px'
loading.value = false
}
@ -22,7 +20,7 @@ onMounted(() => {
<template>
<div v-loading="loading" :style="'height:' + height">
<iframe
:src="frameSrc"
:src="props.src"
style="width: 100%; height: 100%"
frameborder="no"
scrolling="auto"

View File

@ -7,11 +7,11 @@ import VueJsx from '@vitejs/plugin-vue-jsx'
import EslintPlugin from 'vite-plugin-eslint'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import { createStyleImportPlugin, ElementPlusResolve, VxeTableResolve } from 'vite-plugin-style-import'
import progress from 'vite-plugin-progress'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import PurgeIcons from 'vite-plugin-purge-icons'
import { createHtmlPlugin } from 'vite-plugin-html'
import viteCompression from 'vite-plugin-compression'
// 当前执行node命令时文件夹的地址(工作目录)
const root = process.cwd()
@ -54,6 +54,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
Vue(),
VueJsx(),
WindiCSS(),
progress(),
PurgeIcons(),
createStyleImportPlugin({
resolves: [ElementPlusResolve(),VxeTableResolve()],
libs: [{
@ -84,7 +86,6 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
symbolId: 'icon-[dir]-[name]',
svgoOptions: true
}),
PurgeIcons(),
viteCompression({
verbose: true, // 是否在控制台输出压缩结果
disable: false, // 是否禁用
@ -102,7 +103,6 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
}
})
],
css: {
preprocessorOptions: {
less: {
@ -144,6 +144,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
'vue-i18n',
'vxe-table',
'xe-utils',
'lodash-es',
'element-plus/es',
'element-plus/es/locale/lang/zh-cn',
'element-plus/es/locale/lang/en',