Skip to content

Commit 91d4346

Browse files
author
shangbin
committed
update: vant vue3
1 parent ba57524 commit 91d4346

File tree

12 files changed

+364
-275
lines changed

12 files changed

+364
-275
lines changed

package-lock.json

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

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"copy-to-clipboard": "^3.3.1",
3131
"crypto-random-string": "^3.3.1",
3232
"css": "^3.0.0",
33-
"element-plus": "^1.2.0-beta.3",
3433
"css-scoped": "^1.0.0",
34+
"element-plus": "^1.2.0-beta.3",
3535
"escodegen": "^2.0.0",
3636
"espree": "^7.3.0",
3737
"eventemitter3": "^4.0.7",
@@ -43,13 +43,13 @@
4343
"nanoid": "^3.1.30",
4444
"prettier": "^2.4.0",
4545
"split.js": "^1.6.2",
46-
"vant": "^2.10.7",
46+
"vant": "^3.3.7",
4747
"vite": "^2.6.14",
4848
"vue": "^3.2.22",
49-
"vuedraggable": "^4.1.0",
50-
"vuex": "^4.0.2",
49+
"vue-github-button": "^1.3.0",
5150
"vue-template-compiler": "^2.6.14",
52-
"vue-github-button": "^1.3.0"
51+
"vuedraggable": "^4.1.0",
52+
"vuex": "^4.0.2"
5353
},
5454
"devDependencies": {
5555
"@babel/generator": "^7.11.6",

src/components/RawComponents.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@
5959
</div>
6060
</template>
6161
<script>
62-
// import vant from "../rawComponents/vant";
6362
// import iview from "../rawComponents/iview";
6463
// import quasar from "../rawComponents/quasar";
6564
import raw from "../rawComponents/raw/index.vue";
66-
import ele from "../rawComponents/element/index.vue";
65+
import { defineAsyncComponent } from "vue";
6766
6867
export default {
6968
data() {
@@ -87,7 +86,13 @@ export default {
8786
titleArray: [],
8887
}, {
8988
icon: ('https://static.imonkey.xueersi.com/download/vcc-resource/logo/vant-n.png'),
90-
enable: false
89+
clickCallback: this.onSelectElement,
90+
className: "demonstration-vant",
91+
selectIndex: 0,
92+
componentName: 'vant',
93+
enable: true,
94+
titleArray: [],
95+
enable: true
9196
}, {
9297
icon: ('https://static.imonkey.xueersi.com/download/vcc-resource/logo/iview-n.png'),
9398
enable: false
@@ -173,21 +178,12 @@ export default {
173178
}
174179
}
175180
},
176-
surprise() {
177-
const that = this;
178-
function color() {
179-
window.requestAnimationFrame(color);
180-
}
181-
182-
window.requestAnimationFrame(color);
183-
}
184181
},
185182
186183
created() { },
187184
188185
mounted() {
189186
this.init();
190-
// this.surprise();
191187
},
192188
193189
computed: {
@@ -210,10 +206,10 @@ export default {
210206
211207
components: {
212208
raw,
213-
// vant,
209+
vant: defineAsyncComponent(() => import("../rawComponents/vant")),
214210
// iview,
215211
// quasar,
216-
ele,
212+
ele: defineAsyncComponent(() => import("../rawComponents/element/index.vue")),
217213
},
218214
219215
};

src/main.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { createApp } from "vue";
22
import ElementPlus from "element-plus";
3-
import { QuestionFilled, CirclePlus, DocumentCopy, Delete, Refresh, Minus } from "@element-plus/icons";
3+
import {
4+
QuestionFilled,
5+
CirclePlus,
6+
DocumentCopy,
7+
Delete,
8+
Refresh,
9+
Minus,
10+
} from "@element-plus/icons";
411

512
import "element-plus/dist/index.css";
613
import APP from "./App.vue";
@@ -19,12 +26,21 @@ function createBaseApp(renderComponent = {}) {
1926
return app;
2027
}
2128

22-
const globalApp = createBaseApp(APP)
29+
const globalApp = createBaseApp(APP);
2330
globalApp.mount("#app");
2431

2532
// 内部需要同样配置的全局Vue
2633
self.createBaseApp = createBaseApp;
2734
self.globalApp = globalApp; // 内部需要使用Vuex
2835

36+
import("@/libs/store.js");
2937

30-
import("@/libs/store.js");
38+
function loadVant() {
39+
const vantLoadPromise = (() => import("vant"))();
40+
(() => import("vant/lib/index.css"))();
41+
vantLoadPromise.then((vantModule) => {
42+
self.globalApp.use(vantModule);
43+
});
44+
}
45+
46+
loadVant();

src/rawComponents/vant/button.vue

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,70 @@
1-
<template lc_id="7cADZ+9vIL">
2-
<div lc_id="paR1gkzb2P">
3-
<div lc_id="xpLawHH5Ks">
4-
<div class="demonstration" lc_id="LXAb8pRrmp">Button 按钮:</div>
5-
<van-button lc-mark type="primary" lc_id="SrEHhpiQFn">Primary</van-button>
6-
<van-button lc-mark type="info" lc_id="y5KpXFwN4Y">Info</van-button>
7-
<van-button lc-mark type="default" lc_id="lys06/4mtk">Default</van-button>
8-
<van-button lc-mark type="danger" lc_id="vYu5fg0ITt">Danger</van-button>
9-
<van-button lc-mark type="warning" lc_id="gKMFNxDPu4">Warning</van-button>
10-
<van-button lc-mark plain type="primary" lc_id="5ggxtP8mY7">朴素按钮</van-button>
11-
<van-button lc-mark plain type="info" lc_id="J2aDU2i24z">朴素按钮</van-button>
12-
<van-button lc-mark loading type="primary" lc_id="hrHD1DGPGe"></van-button>
13-
<van-button lc-mark loading type="primary" loading-type="spinner" lc_id="fezG6odQJ0"></van-button>
14-
<van-button lc-mark loading type="info" loading-text="加载中..." lc_id="xvgVvk/peN"></van-button>
15-
</div>
16-
<div lc_id="nQa+C7dPYW">
17-
<div class="demonstration" lc_id="hvf2MQVJPH">Cell 单元格:</div>
18-
<van-cell-group lc-mark lc_id="9r3MUvTPyx">
19-
<van-cell title="单元格" value="内容" lc_id="yCbsNk6GF+"></van-cell>
20-
<van-cell title="单元格" value="内容" label="描述信息" lc_id="+30wYnfplY"></van-cell>
21-
<van-cell title="单元格" icon="location-o" lc_id="hxvJ+bSzIM"></van-cell>
22-
<van-cell title="单元格" is-link arrow-direction="down" value="内容" lc_id="vXMVp6xR7q"></van-cell>
23-
</van-cell-group>
24-
</div>
1+
<template >
2+
<div>
3+
<div>
4+
<div class="demonstration-vant">Button 按钮</div>
5+
<div id="vant-button">
6+
<van-button lc-mark type="primary">主要按钮</van-button>
7+
<van-button lc-mark type="success">成功按钮</van-button>
8+
<van-button lc-mark type="default">默认按钮</van-button>
9+
<van-button lc-mark type="warning">警告按钮</van-button>
10+
<van-button lc-mark type="danger">危险按钮</van-button>
11+
12+
<van-button lc-mark plain type="primary">朴素按钮</van-button>
13+
<van-button lc-mark plain type="primary">朴素按钮</van-button>
14+
15+
<van-button lc-mark loading type="primary" />
16+
<van-button lc-mark loading type="primary" loading-type="spinner" />
17+
<van-button lc-mark loading type="primary" loading-text="加载中..." />
18+
19+
<van-button lc-mark square type="primary">方形按钮</van-button>
20+
<van-button lc-mark round type="primary">圆形按钮</van-button>
21+
22+
<van-button lc-mark icon="plus" type="primary" />
23+
<van-button lc-mark icon="plus" type="primary">按钮</van-button>
24+
<van-button lc-mark icon="https://img.yzcdn.cn/vant/user-active.png" type="primary">
25+
按钮
26+
</van-button>
27+
28+
<van-button lc-mark type="primary" size="large">大号按钮</van-button>
29+
<van-button lc-mark type="primary" size="normal">普通按钮</van-button>
30+
<van-button lc-mark type="primary" size="small">小型按钮</van-button>
31+
<van-button lc-mark type="primary" size="mini">迷你按钮</van-button>
32+
33+
<van-button lc-mark type="primary" block>块级元素</van-button>
34+
35+
<van-button lc-mark color="#7232dd">单色按钮</van-button>
36+
<van-button lc-mark color="#7232dd" plain>单色按钮</van-button>
37+
<van-button lc-mark color="linear-gradient(to right, #ff6034, #ee0a24)">
38+
渐变色按钮
39+
</van-button>
2540
</div>
26-
</template>
41+
</div>
42+
<div>
43+
<div class="demonstration-vant">Cell 单元格</div>
44+
<van-cell-group lc-mark>
45+
<van-cell title="单元格" value="内容" />
46+
<van-cell title="单元格" value="内容" label="描述信息" />
47+
</van-cell-group>
48+
<van-cell-group inset>
49+
<van-cell title="单元格" value="内容" />
50+
<van-cell title="单元格" value="内容" label="描述信息" />
51+
</van-cell-group>
52+
</div>
53+
</div>
54+
</template>
2755
<script>
2856
export default {
2957
data() {
3058
return {};
3159
},
3260
methods: {},
3361
}; </script>
34-
<style scoped>button + button {
62+
<style scoped>
63+
button + button {
3564
margin-top: 10px;
36-
}</style>
65+
}
66+
67+
#vant-button > * {
68+
margin: 0 5px 5px 0;
69+
}
70+
</style>

0 commit comments

Comments
 (0)