-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.js
45 lines (43 loc) · 1.18 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
/*
* @Author: 时不待我 [email protected]
* @Date: 2023-02-12 12:21:32
* @LastEditors: 时不待我 [email protected]
* @LastEditTime: 2023-03-26 15:28:04
*/
//app.js
App({
onLaunch: function () {
wx.getSystemInfo({
success: (res) => {
console.log(res);
// 获取可使用窗口宽度
this.globalData.systeminfo.height = res.windowHeight;
// 获取可使用窗口高度
this.globalData.systeminfo.width = res.windowWidth;
// 获取状态栏高度
this.globalData.systeminfo.statusBarHeight = res.statusBarHeight;
}
})
// 获得胶囊按钮位置信息
this.globalData.systeminfo.headerBtnPosi = wx.getMenuButtonBoundingClientRect()
//设置音频播放不受静音开关控制
wx.setInnerAudioOption({
obeyMuteSwitch: false,
success: function (e) {
console.log(e)
console.log('play success')
},
fail: function (e) {
console.log(e)
console.log('play fail')
}
})
},
globalData: {
systeminfo:{
height: 0, width: 0, statusBarHeight: 0 // 状态栏高度
},
headerBtnPosi: null,
StaticURL: 'https://.com',
},
})