Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include 传值在简洁语法中出现 BUG #414

Closed
ciaoca opened this issue Jun 8, 2017 · 3 comments
Closed

include 传值在简洁语法中出现 BUG #414

ciaoca opened this issue Jun 8, 2017 · 3 comments
Labels

Comments

@ciaoca
Copy link

ciaoca commented Jun 8, 2017

1. 错误描述

使用 include 方法,在简洁语法下传值就模板错误,原始语法依然正确。

2. 版本号

4.10.0

3. NodeJS 或浏览器类型与版本

Chrome

4. 可重现的 Demo

简洁语法:http:https://runjs.cn/code/kuykuqp1
原始语法:http:https://runjs.cn/code/u1vbl6lx

@aui
Copy link
Owner

aui commented Jun 8, 2017

简洁语法的 {{}} 界定符可能会与 JS 的语法冲突,你的例子 {{include 'tmp_detail' {note:value.note}}} 就是这样导致的。

建议使用 set data = {} 解决

@fantasy525
Copy link

我在webpack中使用简洁语法也是不行
{{include './header.art' {title:"title"} }}
既然冲突了那就是传入数据时不能用简洁语法了?
按照作者的推荐简洁语法是这样子
{{incllude file data}}
我怎么试都不行,是不是只能用原生语法了?
自己试了好多写法:
{{include './header.art' {title:"title"} }}
{{include ./header.art {title:"title"} }}
{{include './header.art ' '{title:"title"}' }}
{{include ('./header.art ' , {title:"title"} )}}

@aui aui added the bug label Jun 8, 2017
@aui
Copy link
Owner

aui commented Jun 9, 2017

目前标准语法只有 data 为变量的时候才能保证正常工作。

目前能够想到的是让 art-template 的标准语法支持如下语法:

  1. 支持 javascript 函数运行 {{ include('file', {list: []}) }}
  2. 支持使用括号避免语法解析错误 {{ include 'file' ({list: []}) }}

@aui aui closed this as completed in 7486ba5 Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants