liuxy
liuxy
  • 发布:2019-11-11 15:54
  • 更新:2019-11-11 20:49
  • 阅读:2437

【报Bug】nvue uni-app编译模式,destroyed或者beforeDestroy中进行http请求,会报错导致app重启

分类:nvue

详细问题描述

a页面代码:

testa() {  
    console.log('aaaaaaaaaaaaaaaaaaaaaaa');  
    uni.navigateTo({  
        url: '../test/test'  
    })  
},

b页面代码:

created() {  
    console.log('page test');  
    this.test_request();  
},  
destroyed() {  
},  
beforeDestroy() {  
    this.test_request();  
},  
methods: {  
    test_request() {  
        uni.request({  
            url: 'https://www.baidu.com/',  
            success: (res) => {  
                console.log(res.data);  
            }  
        });  
    }  
}

报错内容:

15:50:18.846 reportJSException >>>> exception function:callReportCrash, exception:weex core process crash and restart exception  
15:50:19.071 Error: [JS Framework] Using invalid instance id "4" when calling destroyInstance.  
15:50:19.092 Error: [JS Framework] Using invalid instance id "5" when calling destroyInstance.

[结果]
每次都会导致app重启

IDE运行环境说明

[IDE版本号]
2.3.9 alpha
[windows版本号]
window10

uni-app运行环境说明

nvue uni-app编译模式, weex编译模式也有此问题
[运行端是h5或app或某个小程序?]
安卓app

[编译模式是老模板模式还是新的自定义组件模式?]
自定义组件

2019-11-11 15:54 负责人:无 分享
已邀请:
liuxy

liuxy (作者) - 承接各种公众号小程序app开发, 前后全包,wx或电话咨询联系18724597563

顶一下

陈晨1

陈晨1

这个问题是必现的吗?

  • liuxy (作者)

    必现的,我的正式项目和测试项目,每次都会出现, destroyed和beforeDestroy都会出现

    2019-11-11 18:05

  • 陈晨1

    回复 liuxy: 你发下可复现代码压缩包吧,有可能是你别的配错了

    2019-11-11 18:09

  • liuxy (作者)

    回复 陈晨1: 感谢, 压缩包发在下面了

    2019-11-11 18:31

liuxy

liuxy (作者) - 承接各种公众号小程序app开发, 前后全包,wx或电话咨询联系18724597563

@DCloud_UNI_陈晨 完整的一个测试项目,hbx2.3.9alpha, 标准基座运行到安卓

陈晨1

陈晨1

别放beforeDestroy里了,因为http请求是异步的,销毁后,可能http还没回来,会导致weex崩溃。
换个生命周期吧,或者你当前页跟首页通讯,让首页发http请求。

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