1 Star 0 Fork 0

awesome/wechat-applet-component

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
tangc 提交于 2021-08-04 14:32 . init
// app.js
App({
onLaunch() {
this.getSystemInfo();
wx.setStorageSync('apSession', 'd7da2affab494c0d854916b6fab00be2')
},
globalData: {
},
async getSystemInfo() {
let that = this;
wx.getSystemInfo({
success: function (res) {
let systemInfo = res
// 胶囊按钮位置信息
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
// 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
that.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
that.globalData.menuBottom = menuButtonInfo.top - systemInfo.statusBarHeight;
that.globalData.menuHeight = menuButtonInfo.height;
that.globalData.screenHeight=systemInfo.screenHeight;
that.globalData.screenWidth=systemInfo.screenWidth
}
});
},
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tamgchuan/wechat-applet-component.git
git@gitee.com:tamgchuan/wechat-applet-component.git
tamgchuan
wechat-applet-component
wechat-applet-component
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385