代码拉取完成,页面将自动刷新
//app.js
App({
/**
* 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
*/
onLaunch: function() {
let that = this;
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
wx.showModal({
title: '升级提示',
content: '新版本已经为您准备就绪,是否升级应用?',
success: function(res) {
if (res.confirm) {
updateManager.applyUpdate();
}
}
})
})
}
})
} else {
wx.showModal({
title: '温馨提示',
content: '您当前微信版本过低,为了您的用户体验,建议您升级到最新版微信',
})
}
wx.getSystemInfo({
success: function (res) {
that.globalData.StatusBar = res.statusBarHeight;
let capsule = wx.getMenuButtonBoundingClientRect();
if (capsule) {
that.globalData.Custom = capsule;
that.globalData.CustomBar = capsule.bottom + capsule.top - res.statusBarHeight;
} else {
this.globalData.CustomBar = res.statusBarHeight + 50;
}
}
})
},
/**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function(options) {
},
/**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function() {
},
/**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function(msg) {
},
/**
* 全局配置
*/
globalData: {
}
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。