用户2825120
用户2825120
  • 发布:2025-05-28 14:53
  • 更新:2025-05-28 14:53
  • 阅读:67

uniapp项目在编译完成后,到微信开发者工具中打开后报错TypeError: Cannot read property 'path' of undefined

分类:uni小程序sdk
TypeError: Cannot read property 'path' of undefined  
    at Stat.sendEventRequest (vendor.js? [sm]:27444)  
    at Stat._login (vendor.js? [sm]:27205)  
    at complete (vendor.js? [sm]:27168)  
    at queue (vendor.js? [sm]:223)  
    at Object.callbackInterceptor [as complete] (vendor.js? [sm]:246)  
    at Function.I.forEach.v.<computed> (WAServiceMainContext.js?t=wechat&s=1748412952569&v=3.8.6:1)  
    at :11110/appservice/<api login complete callback function>  
    at Object.complete (WAServiceMainContext.js?t=wechat&s=1748412952569&v=3.8.6:1)  
    at Yd (WAServiceMainContext.js?t=wechat&s=1748412952569&v=3.8.6:1)  
    at WAServiceMainContext.js?t=wechat&s=1748412952569&v=3.8.6:1(env: Windows,mp,1.06.2412050; lib: 3.8.6)

发生这个报错是在第一次打开微信开发者工具报错然后项目就是白屏,重新编译之后又可以正常运行了,看起来像是@dcloudio/uni-stat里的报错,各位大佬如何解决,里面代码如下

{  
    key: "sendEventRequest",  
    value: function sendEventRequest() {  
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},  
        _ref3$key = _ref3.key,  
        key = _ref3$key === void 0 ? '' : _ref3$key,  
        _ref3$value = _ref3.value,  
        value = _ref3$value === void 0 ? '' : _ref3$value;  
      var routepath = '';  
      try {  
        routepath = get_route$1();  
      } catch (error) {  
        var launch_options = dbGet('__launch_options');  

        routepath = launch_options.path;//  报错点进去指向这里  

      }  
      this._navigationBarTitle.config = get_page_name(routepath);  
      this._navigationBarTitle.lt = '21';  
      var options = {  
        ak: this.statData.ak,  
        uuid: this.statData.uuid,  
        p: this.statData.p,  
        lt: '21',  
        ut: this.statData.ut,  
        url: routepath,  
        ch: this.statData.ch,  
        e_n: key,  
        e_v: _typeof(value) === 'object' ? JSON.stringify(value) : value.toString(),  
     usv: this.statData.usv,  
        t: get_time()  
      };  
      this.request(options);  
    }  
  },
2025-05-28 14:53 负责人:DCloud_UNI_GSQ 分享
已邀请:

要回复问题请先登录注册