| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <style lang="scss">
- /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
- @import 'uview-ui/index.scss';
- @import './style/common.scss';
- image {
- image-rendering: -moz-crisp-edges;
- image-rendering: -o-crisp-edges;
- image-rendering: -webkit-optimize-contrast;
- image-rendering: crisp-edges;
- -ms-interpolation-mode: nearest-neighbor;
- }
- </style>
- <script>
- import store from './store'
- export default {
- onLaunch: function () {
- console.log('App Launch')
- const updateManager = uni.getUpdateManager()
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function (res2) {
- uni.showModal({
- title: '更新提示',
- content: '发现新版本,是否重启应用?',
- cancelColor: '#eeeeee',
- confirmColor: '#FF0000',
- success(res2) {
- if (res2.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- },
- })
- })
- }
- })
- updateManager.onUpdateFailed(function (res) {
- // 新的版本下载失败
- uni.showModal({
- title: '提示',
- content: '检查到有新版本,但下载失败,请检查网络设置',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- },
- })
- })
- },
- onShow: function () {
- store.dispatch('getUserInfo')
- // console.log('App Show')
- },
- onHide: function () {
- // console.log('App Hide')
- },
- }
- </script>
|