董路飞
董路飞
  • 发布:2023-08-11 14:38
  • 更新:2025-07-24 18:37
  • 阅读:1295

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

分类:HBuilderX

我这个项目是多端同一套代码,微信小程序正常,h5正常,App跑就报错如下:

14:34:24.099 应用【maxx】已启动  
14:34:30.456 reportJSException >>>> exception function:createInstanceContext, exception:white screen cause create instanceContext failed,check js stack ->  
 at useStore (app-service.js:2126:15)  
 at  (app-service.js:2219:22)  
 at  (app-service.js:4176:3)
2023-08-11 14:38 负责人:无 分享
已邀请:
琦森

琦森

顶啊,25年这个报错还在

董路飞

董路飞 (作者) - 搜索小程序麻丝和 App 麻丝

是因为 我首页 index.vue 引用了 stores/storeB.js 和 stores/storeA.js

而这个 stores/storeA.js 的 pinia 模块又引用了 另一个 pinia 模块 stores/storeB.js ,造成的App无法启动?那为什么在微信小程序和 h5 正常?

  • kernelX

    老哥,碰到相同问题了,可不可以有偿请教一下

    2023-09-22 10:03

  • 2***@qq.com

    老哥解决了嘛 求回复

    2023-11-24 10:15

  • 8***@qq.com

    请问解决了吗,我现在都还有这个问题

    2025-02-28 17:44

  • 1***@qq.com

    回复 8***@qq.com: 解决了吗老哥,我也有

    2025-06-19 11:45

董路飞

董路飞 (作者) - 搜索小程序麻丝和 App 麻丝

太久忘记了,好像是解决了呀,改pinia哪的代码不记得了,大概就是main.js、pinia文件里面这些改动

a***@163.com

a***@163.com

搜索代码里使用Store的地方。不要在方法外定义。我这也调整完之后已经不报这个错了

...  
//注释掉方法外面的定义,移动到实际使用的方法内  
// const counter = useCounterStore();  

/**  
 * 接口请求  
 * @param url 接口地址  
 * @param data 接口参数  
 * @param method 请求方式  
 * @param options 其他配置  
 */  
export function request(url: string, data?: any, method: any = 'get', options: any = {}) {  
    //移动到方法内定义  
    const counter = useCounterStore();  

    counter.increment();  
    if(counter.count === 1){  
        // 设置 loading  
        setLoading();  
    }  

...

要回复问题请先登录注册