我正在使用 AT 在 Debug模式下工作,并且不断收到此类警告:
[aria.templates.TemplateCtxt] Template guides.todo_mio.view.Todo
Line 44: expression is null or undefined.
我的 Todo.tpl 中的第 44 行是:
${( function() { console.log("passed"); } )()}
我用它来记录模板中发生的事情。顺便说一句,它有效..
你有什么建议吗?
谢谢。
最佳答案
在 Aria 模板中,无论在 TPL 文件中做什么,都应该产生一些输出。
警告是为了通知您您的代码中可能存在问题,因为
- 你正在调用一个不返回的函数(也许你忘了返回)
- 你正在使用 undefined variable
- 您正在调用不用于生成标记的方法
后者更多是设计问题,与 View 无关的方法应该在其他地方调用($dataReady
/$afterRefresh
等)
如果您对返回 undefined 的方法没问题,您也可以
- 修改您的方法以返回一个空字符串
使用
eat
或empty
template modifier${( function() { console.log("passed"); } )()|eat}
关于javascript - Aria 模板 - 模板文件 Debug模式下的 "expression is null or undefined"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13159101/