1 Star 0 Fork 186

Soandso / susu-mini-tem

forked from susuhhhhhh / susu-mini-tem 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.js 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
susuhhhhhh 提交于 2022-01-29 23:52 . 1
// app.js
App({
onLaunch() {
// 展示本地存储能力
wx.getSystemInfo({
success: res => {
let Height = res.windowHeight;
this.globalData.Height = Height;
},
})
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 自定义头部
let menuButtonObject = wx.getMenuButtonBoundingClientRect();
wx.getSystemInfo({
success: res => {
//导航高度
let statusBarHeight = res.statusBarHeight,
navTop = menuButtonObject.top,
navObjWid = res.windowWidth - menuButtonObject.right + menuButtonObject.width, // 胶囊按钮与右侧的距离 = windowWidth - right+胶囊宽度
navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
this.globalData.navHeight = navHeight; //导航栏总体高度
this.globalData.navTop = navTop; //胶囊距离顶部距离
this.globalData.navObj = menuButtonObject.height; //胶囊高度
this.globalData.navObjWid = navObjWid; //胶囊宽度(包括右边距离)
this.globalData.windowHeight = res.windowHeight;
this.globalData.windowWidth = res.windowWidth;
// console.log(navHeight,navTop,menuButtonObject.height,navObjWid)
},
fail(err) {
console.log(err);
}
})
},
globalData: {
userInfo: null
}
})
JavaScript
1
https://gitee.com/soandso007/wxmini_demo.git
git@gitee.com:soandso007/wxmini_demo.git
soandso007
wxmini_demo
susu-mini-tem
master

搜索帮助