찾다

 >  Q&A  >  본문

关于android 集成weex 加载js 时报ReferenceError: window is not defined

如题将.we 文件npm run build 后将js拷贝到android asset文件下面,按照官方的集成步骤运行android studio 页面空白 控制台报
04-11 11:48:50.946 3321-3345/com.weex.sample E/jsengine: ReportException :undefined:2212: ReferenceError: window is not defined
04-11 11:48:50.949 3321-3345/com.weex.sample E/jsengine: ReportException : ReferenceError: window is not defined

                     at Object.exports.getBaseUrl (eval at Cn ((weex):2:4300), <anonymous>:2212:21)
                     at Yt.created (eval at Cn ((weex):2:4300), <anonymous>:104:26)
                     at (weex):1:27665
                     at Array.forEach (native)
                     at Yt.zt [as $emit] ((weex):1:27643)
                     at new Yt ((weex):1:29107)
                     at ln ((weex):2:98)
                     at a ((weex):2:2870)
                     at Object.module.exports.type (eval at Cn ((weex):2:4300), <anonymous>:67:2)
                     at __webpack_require__ (eval at Cn ((weex):2:4300), <anonymous>:26:30)

04-11 11:48:50.950 3321-3345/com.weex.sample E/weex: reportJSException >>>> instanceId:2, exception function:createInstance, exception:ReferenceError: window is not defined

巴扎黑巴扎黑2771일 전1046

모든 응답(2)나는 대답할 것이다

  • 大家讲道理

    大家讲道理2017-04-18 09:21:08

    창 개체는 기본 수준에서 지원되지 않습니다

    회신하다
    0
  • PHPz

    PHPz2017-04-18 09:21:08

    페이지가 점프할 때 페이지 URI를 가져오는 데 문제가 있었습니다. window.location.host andorid를 사용했는데 여기서 이 창을 인식하지 못합니다

    exports.getBaseUrl = 함수(bundleUrl, isnav) {

    으아악

    };

    회신하다
    0
  • 취소회신하다