Skip to content

Commit 5dd5d0e

Browse files
aQingYun7insummer
authored andcommitted
feat:示例about页面加入当前版本号 (#350)
1 parent 6ccdf36 commit 5dd5d0e

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

examples/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//app.js
22
App({
3-
onLaunch:function(){
4-
3+
onLaunch: function() {
4+
55
},
66

77
globalData: {
8-
8+
99
}
1010
})

examples/pages/about/index.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
// pages/about/index.js
2+
wx.cloud.init({
3+
env: 'env-9eb476'
4+
})
5+
const db = wx.cloud.database()
6+
27
Page({
38

49
/**
510
* 页面的初始数据
611
*/
712
data: {
8-
13+
version:'....'
914
},
1015

1116
/**
1217
* 生命周期函数--监听页面加载
1318
*/
1419

15-
onLoad: function (options) {
16-
20+
onLoad: function(options) {
21+
db.collection('version').get().then(_ => {
22+
const {
23+
data
24+
} = _
25+
this.setData({
26+
version: data[0].version
27+
})
28+
})
1729
},
1830

19-
copyLink(e){
31+
copyLink(e) {
2032
wx.setClipboardData({
2133
data: e.currentTarget.dataset.link,
2234
success: () => {
@@ -28,9 +40,7 @@ Page({
2840
})
2941
},
3042

31-
32-
33-
onImage(){
43+
onImage() {
3444
wx.previewImage({
3545
urls: ['https://pic1.zhimg.com/80/v2-efda715dcd7e93325b213400b67c1e80_hd.png']
3646
});
@@ -39,7 +49,7 @@ Page({
3949
/**
4050
* 用户点击右上角分享
4151
*/
42-
onShareAppMessage: function () {
52+
onShareAppMessage: function() {
4353

4454
}
4555
})

examples/pages/about/index.wxml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<!--pages/about/index.wxml-->
1+
<!-- pages/about/index.wxml -->
22
<view class='container'>
33
<view class='logo-container'>
44
<image class='logo-img' src='/images/logo.png'></image>
5+
<text class='version'>组件库版本号:v{{version}}</text>
56
</view>
67
<view class='address-container'>
78
<view class='dot' />

examples/pages/about/index.wxss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ page {
6464
color: #596c8e;
6565
}
6666

67+
.version {
68+
font-size: 30rpx;
69+
color: #3963bc;
70+
margin-top: 20rpx;
71+
}
72+
6773
.code {
6874
width: 210rpx;
6975
height: 210rpx;

0 commit comments

Comments
 (0)