uni-app app热更新+整包更新 使用uniCloud开发

App端插件:

https://ext.dcloud.net.cn/plugin?id=4542

网页端后台(统一管理多个app的整包和热更新):

https://ext.dcloud.net.cn/plugin?id=4470

网页端后台我是自己搭了一个,并且通过uniCloud托管后台网页

新增一个app的更新步骤

1、把uni-upgrade-center - App插件引入项目

2、 找到/uni_modules/uni-upgrade-center-app/uniCloud/cloudfunctions/check-version,右键上传部署

3、在pages.json中添加页面路径

"pages": [
    // ……其他页面配置
    {
        "path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
        "style": {
            "disableScroll": true,
            "app-plus": {
                "backgroundColorTop": "transparent",
                "background": "transparent",
                "titleNView": false,
                "scrollIndicator": false,
                "popGesture": "none",
                "animationType": "fade-in",
                "animationDuration": 200

            }
        }
    }
]

4、将/uni_modules/uni-upgrade-center-app/utils/check-update import到需要用到的地方,调用一下即可,我这边是放在App.vue中

// #ifdef APP-PLUS
    import updata from '@/uni_modules/uni-upgrade-center-app/utils/check-update'
// #endif
    export default {
    onLaunch: function() {
        // #ifdef APP-PLUS
        updata()
        // #endif
    }            

5、创建uniCloud云开发环境,选择阿里云,

然后关联到后台的的服务空间

这样就可以了

uniCloud和uni_modules里的是同一个,并且会自动同步

原文地址:https://www.cnblogs.com/fhysy/p/14972932.html