12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <script>
- export default {
- onLaunch: function() {
- wx.onAppRoute(function(res) {
- let pages = getCurrentPages()
- let view = pages[pages.length - 1]
- if(view) {
- wx.showShareMenu({
- withShareTicket:true,
- menus:['shareAppMessage','shareTimeline']
- })
- }
- })
- console.log('App Launch')
- },
- onShow: function() {
- const updateManager = uni.getUpdateManager();
-
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log(res);
- });
-
- updateManager.onUpdateReady(function (res) {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
-
- });
-
- updateManager.onUpdateFailed(function (res) {
- debugger
- // 新的版本下载失败
- console.log('download error')
- uni.showModal({
- title: '提示',
- content: '新版小程序下载失败\n请自行退出程序,手动卸载本程序,再运行',
- confirmText: "知道了"
- });
- });
- },
- onHide: function() {
- console.log('App Hide')
- }
- }
- </script>
- <style lang="scss">
- @import "uview-ui/index.scss";
- @import "./assets/style.less";
- /*每个页面公共css */
- </style>
|