| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <script>
- import setting from "./assets/http/setting.js"
- export default {
- onLaunch: function() {
- //开启调试模式
- this.setEnableDebug()
- //获取审核状态
- this.$u.vuex('vuex_audit',0)
- //更新版本
- this.updateApp()
- },
- methods:{
- setEnableDebug(){
- uni.setEnableDebug({
- enableDebug: setting.enabledDebug
- })
- },
- updateApp(){
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log("是否有新版本:",res.hasUpdate);
- });
- updateManager.onUpdateReady(function (res) {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }
- }
- });
-
- });
- updateManager.onUpdateFailed(function (res) {
- // 新的版本下载失败
- });
- }
- }
- }
- </script>
- <style lang="scss">
- @import "uview-ui/index.scss";
- @import "assets/colorui/main.css";
- @import "assets/colorui/icon.css";
- @import "assets/colorui/app.scss"; /* 你的项目css */
- </style>
|