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页面中(此方案虽然可以暂时解决,但再进行其他引入时,依然会报错,不如方案一好使)

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐