0

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

意外的标记 '}'。无法解析语句。

我试图搜索类似的线索: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
4

2 回答 2

0

最后我解决了这个问题(由调用错误的方法引起)。

对于那些需要演示以查看如何在 Fragment 中渲染 Weex 页面的人,请尝试使用 weex -start-kit

于 2018-08-17T03:26:55.553 回答
0

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

于 2018-08-14T06:30:19.017 回答