reportJSException >>>> exception function:createInstanceContext, exception:white screen cause create

文章描述了在uni-app中从vue2环境切换到包含vue3特性的nvue界面时遇到的错误,即TypeError:_vue.effectScope不是一个函数。给出了两种解决方案:注释掉不兼容的vue3样式和将nvue作为子组件引入vue页面。后者存在局限性。
摘要由CSDN通过智能技术生成

uni-app进入nvue界面时,报错:

reportJSException >>>> exception function:createInstanceContext, exception:white screen cause create instanceContext failed,check js stack ->Uncaught TypeError: (0 , _vue.effectScope) is not a function

at resetStoreState (/pages/remote/remote.nvue:4788:36)
 at Store (/pages/remote/remote.nvue:5544:3)
 at eval (<anonymous>:12:13)
 at eval (<anonymous>:229:30)
 at  (/pages/remote/remote.nvue:4630:1)
 at __webpack_require__ (/pages/remote/remote.nvue:21:30)
 at eval (<anonymous>:10:37)
 at  (/pages/remote/remote.nvue:4597:1)
 at __webpack_require__ (/pages/remote/remote.nvue:21:30)
 at eval (<anonymous>:8:39)

报错原因:vue.effectScope是vue3中引入的一个函数,笔者猜测对于某些样式需要vue3的支持,但公司用的是vue2,所以导致错误

解决方案:方案一:将编译环境不支持的样式注释掉,如line-height:normal等;方案二:将nvue作为子组件引入到vue页面中(此方案虽然可以暂时解决,但再进行其他引入时,依然会报错,不如方案一好使)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值