e***@qq.com
e***@qq.com
  • 发布:2021-09-24 23:54
  • 更新:2021-09-24 23:54
  • 阅读:397

【报Bug】真机调试/自定义基座没有问题,打包后出现启动图无限等待,白屏,未进入main.js等问题

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.2.3

手机系统: Android

手机系统版本号: Android 11

手机厂商: google

手机机型: pixel3

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: 链接: https://pan.baidu.com/s/1vWbXuV9-AQ9tBDODz9n4Hw 提取码: gacx

示例代码:

app.vue

<script>  
    import app from 'api/app.js'  
    export default {  
        onLaunch() {  
            // let that = this  
            // try {  
            //  // #ifdef APP-VUE | APP-NVUE | APP-PLUS  
            //  plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {  
            //      let app_name = widgetInfo.name  
            //      let app_version = widgetInfo.version  

            //      // APP初始化  
            //      app.init(app_version).then(response => {  
            //          // 是否有更新  
            //          let update = response.data.data.update  
            //          if (update.update && update.apkUrl.length>0) { // apk更新  
            //              uni.showModal({  
            //                  title:"新版本 " + update.version,  
            //                  content:update.content,  
            //                  showCancel:!update.enforce, // 强制更新  
            //                  success(res) {  
            //                      if (res.confirm) {  
            //                          // TODO 弹出下载  
            //                          plus.runtime.openURL(that.cdnurl(update.apkUrl));  
            //                          plus.runtime.quit();  
            //                      } else if (res.cancel && update.enforce) {  
            //                          // 不更新不给用  
            //                          plus.runtime.quit();  
            //                      }  
            //                  }  
            //              })  
            //          } else if (update.update && update.wgtUrl.length>0) { // 热更新  
            //              uni.downloadFile({  
            //                  url:that.cdnurl(update.wgtUrl),  
            //                  success(downloadResult) {  
            //                       if (downloadResult.statusCode === 200) {   
            //                           // 安装更新  
            //                          plus.runtime.install(downloadResult.tempFilePath, {    
            //                              force: false    
            //                          }, function() {    
            //                              console.log('install success...');    
            //                              plus.runtime.restart();    
            //                          }, function(e) {    
            //                              console.error('install fail...');    
            //                          });    
            //                      }    
            //                  }    
            //              })  
            //          }  

            //      });  
            //  })  
            // // #endif  

            // } catch (error) {  
            //  uni.showToast({  
            //      title:error.message,  
            //      icon:"none"  
            //  })  
            // }  
        },  
        onError(err) {  
            console.log(err);  
            uni.showToast({  
                title:"系统发生了一点问题,请稍后再试~",  
                icon:"none"  
            })  
        },  
        onShow: function() {  
            console.log('App Show')  
        },  
        onHide: function() {  
            console.log('App Hide')  
        }  
    }  
</script>  

<style>  
    /*每个页面公共css */  
</style>

main.js

import Vue from 'vue'  
import App from './App'  
import store from "@/config/store";  
import Top from '@/components/top/top.vue';  

Vue.config.productionTip = false  

App.mpType = 'app'  
Vue.prototype.$store = store;  

Vue.component('top', Top);  

Vue.prototype.cdnurl = function(url) {  
    return store.state.config.cos.cdnurl + url;  
}  

Vue.prototype.error = function(msg = '') {  
    uni.showModal({  
        content:msg||'发生未知错误',  
        showCancel:false  
    })  
}  

Vue.prototype.timeFormat = function(time =+ new Date()) {  
    var date = new Date(time + 8 * 3600 * 1000); // 增加8小时  
    return date.toJSON().substr(0, 19).replace('T', ' ');  
}  

Date.prototype.Format = function(fmt) {  
  var o = {  
    "M+" : this.getMonth()+1,                 //月份  
    "d+" : this.getDate(),                    //日  
    "h+" : this.getHours(),                   //小时  
    "m+" : this.getMinutes(),                 //分  
    "s+" : this.getSeconds(),                 //秒  
    "q+" : Math.floor((this.getMonth()+3)/3), //季度  
    "S"  : this.getMilliseconds()             //毫秒  
  };  
  if(/(y+)/.test(fmt))  
    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));  
  for(var k in o)  
    if(new RegExp("("+ k +")").test(fmt))  
  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));  
  return fmt;  
}  

uni.showToast({  
    title:"222"  
})  

const app = new Vue({  
    store,  
    ...App  
})  
app.$mount()  
export default app;

操作步骤:

打开app即可

预期结果:

打开app后进入启动图,完毕后进入登录页面

实际结果:

白屏/启动图无限等待

bug描述:

问题:真机调试-正常无报错,自定义基座调试-正常无报错,安心打包or传统打包(一直卡在启动图,无报错提示, 无网络请求,无页面跳转,main.js的uni.showtoast弹窗也不显示,勾选关闭splash图后打包 启动图等待10s左右显示白屏)

App.vue 中已经把所有业务给屏蔽了;
main.js中加入了一个uni.showtoast弹窗;

2021-09-24 23:54 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复