关于android 集成weex 加载js 时报ReferenceError: window is not defined
巴扎黑
巴扎黑 2017-04-18 09:19:08
0
2
1028

如题将.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

巴扎黑
巴扎黑

全員に返信(2)
大家讲道理

ウィンドウ オブジェクトはネイティブ レベルではサポートされていません

いいねを押す +0
PHPzhong

答えが見つかりました。ページがジャンプするときにページ URI を取得するときに問題が発生しました。window.location.host andorid を使用しましたが、ここではこのウィンドウを認識できません。

exports.getBaseUrl = 関数 (bundleUrl, isnav) {

リーリー

};

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!