9 Star 146 Fork 32

Eve996 / ThorUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.js 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
thorui.cn 提交于 2023-11-04 09:51 . V2.9.5更新
App({
onLaunch: function() {
// 获取小程序更新机制兼容
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经上线啦~,为了获得更好的体验,建议立即更新',
showCancel: false,
confirmColor: "#5677FC",
success: function(res) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
})
})
updateManager.onUpdateFailed(function() {
// 新的版本下载失败
wx.showModal({
title: '更新失败',
content: '新版本更新失败,为了获得更好的体验,请您删除当前小程序,重新搜索打开',
confirmColor: "#5677FC",
showCancel: false
})
})
}
})
} else {
// 当前微信版本过低,无法使用该功能
}
},
onError(err) {
//全局错误监听
//console.log("发生错误:"+err)
// const res = wx.getSystemInfoSync()
// let errMsg = "手机品牌:" + res.brand + ";手机型号:" + res.model + ";微信版本号:" + res.version + ";操作系统版本:" + res.system + ";客户端平台:" + res.platform + ";错误描述:" + err;
},
globalData: {
isLogin: wx.getStorageSync("thorui_mobile") ? true : false,
version: "2.9.5",
isOnline:true,
mobile:wx.getStorageSync("thorui_mobile") || "",
statusBarHeight:0,
navigationBarHeight:0,
navigationBarWidth:0
}
})
JavaScript
1
https://gitee.com/echo0927/ThorUI.git
git@gitee.com:echo0927/ThorUI.git
echo0927
ThorUI
ThorUI
master

搜索帮助