-
Notifications
You must be signed in to change notification settings - Fork 76
/
app.js
47 lines (46 loc) · 1.25 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
wx.onNetworkStatusChange(function(res) {
//alert(res.isConnected)
console.log(res.networkType)
})
},
onShow: function () {
//检测用户是否微信版本是否支持自定义组件
this.checkVersion()
},
checkVersion: function () {
const version = Number(wx.getSystemInfoSync().SDKVersion.split('.').join(''))
const canUseComponent = 163
if (version < canUseComponent) {
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
wx.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
success: function(res) {
if (res.confirm || res.cancel) {
// 关闭小程序
wx.navigateBack({
delta: 0
})
}
}
})
}
return;
},
globalData: {
userInfo: null,
selectsinger: null,
currentIndex: 0,
fullScreen: false,
songlist: [],
playing: false,
innerAudioContext: null
}
})