| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <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')
- },
- onShow: function () {
- const updateManager = uni.getUpdateManager()
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function () {
- uni.showModal({
- title: '更新提示',
- content: '发现新版本,是否重启应用?',
- cancelColor: '#eeeeee',
- confirmColor: '#FF0000',
- success(resp) {
- if (resp.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- },
- })
- })
- }
- })
- updateManager.onUpdateFailed(function (res) {
- // 新的版本下载失败
- uni.showModal({
- title: '提示',
- content: '检查到有新版本,但下载失败,请检查网络设置',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- },
- })
- })
- store.dispatch('getUserInfo')
- },
- onHide: function () {
- },
- }
- </script>
|