uniapp:exception:white screen cause create instanceContext failed,check js stack -> at useStore

关于uniapp使用vue3打包APP报错:exception:white screen cause create instanceContext failed,check js stack -> at useStore的解决方案;

1.错误原因:

因为项目使用了pinia,使用vue3的写法导致超前调用,目前仅在打包APP时出现过,小程序和H5暂未出现这个错误。

2.解决方案:

方案一:使用vue3  setup模式

uniapp:exception:white screen cause create instanceContext failed,check js stack -> at useStore_第1张图片

方案二:如果页面使用Options Api,在方法内调用

uniapp:exception:white screen cause create instanceContext failed,check js stack -> at useStore_第2张图片

你可能感兴趣的:(javascript,uni-app,前端,vue)