60 lines
1.4 KiB
Vue
60 lines
1.4 KiB
Vue
|
<script>
|
||
|
import {mapMutations } from 'vuex';
|
||
|
// import "@/uni_modules/uview-ui/index.scss";
|
||
|
export default {
|
||
|
onLaunch: function() {
|
||
|
console.log('App Launch')
|
||
|
},
|
||
|
onShow: function() {
|
||
|
const updateManager = wx.getUpdateManager()
|
||
|
updateManager.onCheckForUpdate(function(res) {
|
||
|
// 请求完新版本信息的回调
|
||
|
console.log(res.hasUpdate)
|
||
|
if (res.hasUpdate) {
|
||
|
updateManager.onUpdateReady(function() {
|
||
|
wx.showModal({
|
||
|
title: '更新提示',
|
||
|
content: '新版本已经准备好,是否重启应用?',
|
||
|
success(res) {
|
||
|
if (res.confirm) {
|
||
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||
|
updateManager.applyUpdate()
|
||
|
this.clearuserInforma()
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}),
|
||
|
updateManager.onUpdateFailed(function() {
|
||
|
wx.showModal({
|
||
|
title: '已经有新版本了哟~',
|
||
|
content: '新版本已经上线啦,请删除当前小程序,重新搜索'
|
||
|
})
|
||
|
// 新版本下载失败
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
|
||
|
},
|
||
|
methods:{
|
||
|
...mapMutations({
|
||
|
clearuserInforma:'users/clearuserInforma'
|
||
|
}),
|
||
|
},
|
||
|
onHide: function() {
|
||
|
console.log('App Hide')
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
.swiper .wx-swiper-dot {
|
||
|
position: relative;
|
||
|
bottom: 24rpx;
|
||
|
}
|
||
|
// 当前选中样式
|
||
|
.swiper .wx-swiper-dot-active {
|
||
|
background-color: red;
|
||
|
|
||
|
}
|
||
|
/*每个页面公共css */
|
||
|
</style>
|