Commit 7a1c11dc authored by linwenqing's avatar linwenqing

refactor:我的设置-版本更新

parent 21f7c778
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
title="版本更新" title="版本更新"
value="当前版本v1.1.0" value="当前版本v1.1.0"
:border-bottom="false" :border-bottom="false"
@tap="upgrade"
></u-cell-item> ></u-cell-item>
</u-cell-group> </u-cell-group>
<view class="logout" @tap="logout">退出登录</view> <view class="logout" @tap="logout">退出登录</view>
...@@ -19,6 +20,27 @@ export default { ...@@ -19,6 +20,27 @@ export default {
computed: {}, computed: {},
onLoad() {}, onLoad() {},
methods: { methods: {
upgrade: function() {
wx.showToast({
title: '正在更新版本...',
icon: 'loading',
})
const um = wx.getUpdateManager()
um.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
um.onUpdateReady(function() {
um.applyUpdate()
wx.showToast({
title: '更新完成',
})
})
} else {
wx.showToast({
title: '已是最新版本',
})
}
})
},
logout() { logout() {
this.$u.vuex('vuex_token', '') this.$u.vuex('vuex_token', '')
this.$u.vuex('openId', '') this.$u.vuex('openId', '')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment