Skip to content

Commit 7a44470

Browse files
committed
组件文件和easycom配置
1 parent e8f2caf commit 7a44470

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<button>test</button>
3+
</template>

my-project-vue2/src/pages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"easycom": {
3-
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
3+
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue",
4+
"^lb-(.*)": "@/components/lb-$1/lb-$1.vue"
45
},
56
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
67
{

my-project-vue2/src/pages/home/index.vue

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,39 @@
1212
<u-button type="warning">警告按钮</u-button>
1313
<u-button type="error">危险按钮</u-button>
1414

15+
<!-- 自定义的组件,已配置easycom,无需引入 -->
16+
<lb-button></lb-button>
17+
1518
<!-- 自定义tabbar -->
1619
<!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
1720
</view>
1821
</template>
1922

2023
<script>
2124
export default {
22-
data() {
23-
return {
24-
title: 'Hello lanba jam!'
25-
}
26-
},
27-
onLoad() {
28-
this.$u.vuex('vuex_user.name', '诗圣');
29-
this.$u.toast('Hello uView!');
30-
// this.getInfo()
31-
},
32-
methods: {
33-
onToPage() {
34-
uni.navigateTo({
35-
url: '/pages_sub/home/index'
36-
});
37-
},
38-
async getInfo() {
39-
let params = {
40-
id: 222
41-
}
42-
let res = await this.$u.api.getInfo(params)
43-
}
44-
}
25+
data() {
26+
return {
27+
title: "Hello lanba jam!"
28+
};
29+
},
30+
onLoad() {
31+
this.$u.vuex("vuex_user.name", "诗圣");
32+
this.$u.toast("Hello uView!");
33+
// this.getInfo()
34+
},
35+
methods: {
36+
onToPage() {
37+
uni.navigateTo({
38+
url: "/pages_sub/home/index"
39+
});
40+
},
41+
async getInfo() {
42+
let params = {
43+
id: 222
44+
};
45+
let res = await this.$u.api.getInfo(params);
46+
}
47+
},
4548
}
4649
</script>
4750

0 commit comments

Comments
 (0)