Skip to content

Commit 8d3f617

Browse files
docs: ✏️ 优化文档及演示demo访问速度 (#232)
* docs: ✏️ 优化文档及演示demo访问速度 * docs: ✏️ 按需引入ElementPlus
1 parent f575339 commit 8d3f617

File tree

17 files changed

+261
-141
lines changed

17 files changed

+261
-141
lines changed

docs/.vitepress/config.mts

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,51 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2023-07-27 10:26:09
4-
* @LastEditTime: 2024-03-20 13:15:11
4+
* @LastEditTime: 2024-04-10 11:31:29
55
* @LastEditors: weisheng
66
* @Description:
7-
* @FilePath: \wot-design-uni\docs\.vitepress\config.ts
7+
* @FilePath: \wot-design-uni\docs\.vitepress\config.mts
88
* 记得注释
99
*/
1010
import { defineConfig } from 'vitepress';
11+
import viteCompression from 'vite-plugin-compression'
12+
import AutoImport from 'unplugin-auto-import/vite'
13+
import Components from 'unplugin-vue-components/vite'
14+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
15+
1116

1217
export default defineConfig({
18+
vite: {
19+
plugins: [
20+
AutoImport({
21+
resolvers: [ElementPlusResolver()],
22+
}),
23+
Components({
24+
resolvers: [ElementPlusResolver()],
25+
}),
26+
viteCompression({
27+
verbose: true,
28+
disable: false,
29+
threshold: 10240,
30+
algorithm: 'gzip',
31+
ext: '.gz',
32+
})
33+
],
34+
ssr: { noExternal: ['element-plus'] }
35+
// build: {
36+
// terserOptions: {
37+
// compress: {
38+
// //生产环境时移除console
39+
// drop_console: true,
40+
// drop_debugger: true
41+
// }
42+
// },
43+
// // 关闭文件计算
44+
// reportCompressedSize: false,
45+
// // 关闭生成map文件 可以达到缩小打包体积
46+
// sourcemap: false // 这个生产环境一定要关闭,不然打包的产物会很大
47+
// }
48+
},
1349
title: `Wot Design Uni`,
1450
description: '一个参照wot-design打造的uni-app组件库',
1551
head: [

docs/.vitepress/theme/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2023-07-27 12:36:30
4-
* @LastEditTime: 2024-04-01 17:11:39
4+
* @LastEditTime: 2024-04-10 10:58:31
55
* @LastEditors: weisheng
66
* @Description:
77
* @FilePath: \wot-design-uni\docs\.vitepress\theme\index.ts
@@ -12,8 +12,6 @@ import Theme from 'vitepress/theme'
1212
import './styles/vars.css'
1313
import './styles/custom.css'
1414
import './styles/scrollbar.scss'
15-
import ElementPlus from 'element-plus'
16-
import 'element-plus/dist/index.css'
1715

1816
import HomeFriendly from './components/HomeFriendly.vue'
1917
import NavBarTitleAfter from './components/NavBarTitleAfter.vue'
@@ -34,7 +32,6 @@ export default {
3432
})
3533
},
3634
enhanceApp({ app }) {
37-
app.use(ElementPlus)
3835
app.component('SvgImage', SvgImage)
3936
app.component('frame', frame)
4037
},

docs/auto-imports.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// noinspection JSUnusedGlobalSymbols
5+
// Generated by unplugin-auto-import
6+
export {}
7+
declare global {
8+
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
9+
}

docs/components.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// Generated by unplugin-vue-components
5+
// Read more: https://github.com/vuejs/core/pull/3399
6+
export {}
7+
8+
declare module 'vue' {
9+
export interface GlobalComponents {
10+
ElTag: typeof import('element-plus/es')['ElTag']
11+
RouterLink: typeof import('vue-router')['RouterLink']
12+
RouterView: typeof import('vue-router')['RouterView']
13+
}
14+
}

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ footer: false
5050

5151
<script setup lang="ts">
5252
import { onMounted } from 'vue'
53-
import { ElMessage, ElMessageBox } from 'element-plus'
5453
onMounted(()=>{
5554
if (window.location.hostname === 'wot-design-uni.cn') {
5655
ElMessageBox.confirm('您正在访问的站点速度较慢,是否跳转至更快的 wot-design-uni.gitee.io ?', '提示', {

docs/public/alipay.png

-20.1 KB
Loading

docs/public/alipayQrcode.jpg

-20.7 KB
Loading

docs/public/phone-case.png

-48.7 KB
Binary file not shown.

docs/public/phtitle.png

-4.79 KB
Binary file not shown.

docs/public/weixinQrcode.jpg

-60.3 KB
Loading

0 commit comments

Comments
 (0)