初始化
This commit is contained in:
58
app.js
Normal file
58
app.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// app.js
|
||||
App({
|
||||
towxml: require('/towxml/index'),
|
||||
globalData: {
|
||||
userInfo: null
|
||||
},
|
||||
onLaunch() {
|
||||
const updateManager = wx.getUpdateManager()
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
console.log('检查更新');
|
||||
// 请求完新版本信息的回调
|
||||
})
|
||||
updateManager.onUpdateReady(function () {
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已经准备好,是否重启应用?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
updateManager.onUpdateFailed(function () {
|
||||
// 新的版本下载失败
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本下载失败',
|
||||
showCancel: false
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
! function () {
|
||||
//获取页面配置并进行页面分享配置
|
||||
var PageTmp = Page
|
||||
Page = function (pageConfig) {
|
||||
//全局开启分享
|
||||
pageConfig = Object.assign({
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: "分享标题",
|
||||
path: "/pages/home/index",
|
||||
imageUrl: ""
|
||||
};
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: "分享标题",
|
||||
path: "/pages/home/index",
|
||||
};
|
||||
}
|
||||
}, pageConfig);
|
||||
PageTmp(pageConfig);
|
||||
}
|
||||
}();
|
||||
|
||||
Reference in New Issue
Block a user