Skip to content

Commit e8db3e3

Browse files
author
shangbin
committed
update: 合并antd
1 parent c4cf57d commit e8db3e3

File tree

4 files changed

+174
-21
lines changed

4 files changed

+174
-21
lines changed

package-lock.json

Lines changed: 149 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
},
5555
"devDependencies": {
5656
"@babel/generator": "^7.11.6",
57+
"@rollup/plugin-dynamic-import-vars": "^1.4.1",
5758
"@vue/cli-plugin-babel": "^4.2.0",
5859
"@vue/cli-plugin-eslint": "^4.2.0",
5960
"@vue/cli-plugin-pwa": "^4.2.0",
@@ -63,11 +64,11 @@
6364
"eslint": "^6.7.2",
6465
"eslint-plugin-import": "^2.20.1",
6566
"eslint-plugin-vue": "^6.1.2",
67+
"is-obj": "^3.0.0",
68+
"is-regexp": "^3.0.0",
6669
"lint-staged": "^9.5.0",
6770
"sass": "^1.25.0",
68-
"sass-loader": "^8.0.2",
69-
"is-obj": "^3.0.0",
70-
"is-regexp": "^3.0.0"
71+
"sass-loader": "^8.0.2"
7172
},
7273
"eslintConfig": {
7374
"root": true,

src/libs/UIComponentInit.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// 其它UI组件库应该在这里集成
2+
function loadVant() {
3+
const vantLoadPromise = (() => import("vant"))();
4+
(() => import("vant/lib/index.css"))();
5+
vantLoadPromise.then((vantModule) => {
6+
self.globalApp.use(vantModule);
7+
});
8+
}
9+
10+
function loadAntD() {
11+
const vantLoadPromise = (() => import("ant-design-vue"))();
12+
(() => import("ant-design-vue/dist/antd.css"))();
13+
vantLoadPromise.then((vantModule) => {
14+
self.globalApp.use(vantModule);
15+
});
16+
}
17+
18+
loadAntD();
19+
loadVant();

src/main.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ import {
88
Refresh,
99
Minus,
1010
} from "@element-plus/icons";
11-
1211
import "element-plus/dist/index.css";
13-
import APP from "./App.vue";
1412

15-
import Antd from 'ant-design-vue';
16-
import 'ant-design-vue/dist/antd.css';
13+
import APP from "./App.vue";
1714

1815
function createBaseApp(renderComponent = {}) {
1916
const app = createApp(renderComponent);
2017
app.use(ElementPlus);
21-
app.use(Antd);
2218

2319
app.component("question-filled", QuestionFilled);
2420
app.component("circle-plus", CirclePlus);
@@ -38,13 +34,4 @@ self.createBaseApp = createBaseApp;
3834
self.globalApp = globalApp; // 内部需要使用Vuex
3935

4036
import("@/libs/store.js");
41-
42-
function loadVant() {
43-
const vantLoadPromise = (() => import("vant"))();
44-
(() => import("vant/lib/index.css"))();
45-
vantLoadPromise.then((vantModule) => {
46-
self.globalApp.use(vantModule);
47-
});
48-
}
49-
50-
loadVant();
37+
import("@/libs/UIComponentInit.js");

0 commit comments

Comments
 (0)