Weex 在 Fragment 中渲染失败

Weex failed to render in Fragment

我是Weex新手,需要在Android的Fragment中渲染Weex。但是,它因错误而失败:

Unexpected token '}'. Cannot parse statement.

我试图搜索以下线索:ISSUE:How to load Weex into Fragment 但我没有找到解决方案。

输出日志如下:

08-13 12:16:36.306 20983-20983 E/JL: [ main: 
(WeexPageFragment.java:59) loadWeex ] - 
renderhttp://172.16.43.62:8080/dist/hello.js
08-13 12:16:36.306 20983-20983 D/WXSDKInstance: Start render page: 
08-13 12:16:36.308 20983-21003 D/weex: createInstance >>>> 
instanceId:1, options:{}, data:
callJS >>>> instanceId:1function:createInstance
08-13 12:16:36.342 20983-21003 D/jsLog: [JS Framework] COMPATIBILITY 
WARNING: Weex DSL 1.0 (.we) framework is no longer supported! It will 
be removed in the next version of WeexSDK, your page would be crash if 
you still using the ".we" framework. Please upgrade it to Vue.js or 
Rax.__ERROR
08-13 12:16:36.360 20983-21003 E/jsengine:  ReportException : 
Exception: SyntaxError: Unexpected token '}'. Cannot parse statement.
at (global function):8
Function@[native code]
Function@[native code]
(weex framework):1:148499
ei@(weex framework):1:148517
createInstance@(weex framework):1:151735
(weex framework):1:255299
08-13 12:16:36.360 20983-21003 E/weex: reportJSException >>>> 
instanceId:1, exception function:createInstance, exception:Exception: 
SyntaxError: Unexpected token '}'. Cannot parse statement.
at (global function):8
Function@[native code]
Function@[native code]
(weex framework):1:148499
ei@(weex framework):1:148517
createInstance@(weex framework):1:151735
(weex framework):1:255299

SyntaxError: Unexpected token '}'是解析或执行不完整js代码时很常见的错误。可能是你页面的 js bundle 在渲染之前没有完全下载。

终于解决了这个问题(方法调用错误导致)

对于那些需要演示的人来说How to render Weex page in Fragment试试这个weex-start-kit