1234567891011121314151617181920212223242526272829303132333435363738 |
- //app.js
- App({
- onLaunch: function() {
- var info = wx.getSystemInfoSync()
- this.config.ua = 'ProgramPool#' + info.system + '~' + info.version + '~' + info.SDKVersion + '#100'
- this.config.width = info.screenWidth;
- this.update();
- },
- config: {
- debug: false,
- width: 0,
- ua: '',
- code: '',
- key: '',
- loginTime: 0,
- },
- log: function(text) {
- if (this.config.debug) {
- console.log(text);
- }
- },
- update: function() {
- const updateManager = wx.getUpdateManager();
- updateManager.onUpdateReady(function() {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- }
- })
|