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

art-template-web在input type=checkbox时有解析bug #544

Closed
isszz opened this issue Jun 21, 2018 · 7 comments
Closed

art-template-web在input type=checkbox时有解析bug #544

isszz opened this issue Jun 21, 2018 · 7 comments

Comments

@isszz
Copy link

isszz commented Jun 21, 2018

<input{{ value.status ? ' checked' : ''}} type="checkbox">
上面这样写会报错
CompileError: Unexpected token = generated: $$out+=value.status="" ?="" 'checked'="" :="" ''

@isszz
Copy link
Author

isszz commented Jun 21, 2018

<input{{ if value.status }} checked="checked"{{ /if }} type="checkbox">
我试了这样写一样是报错的...

{{ if value.status }}
<input checked="checked" type="checkbox">
{{ else }}
<input type="checkbox">
{{ /if }}

实在没辙只能改成这样了...

@aui
Copy link
Owner

aui commented Jun 25, 2018

在默认配置下,是能够正常编译的,如图:
image
你应该按照规范提交问题:提供可以重现的 DEMO

@isszz
Copy link
Author

isszz commented Jul 17, 2018

@aui 我发现好多语法不支持....最近什么> < 之类的还有就是一个if多个判断...都提示错误,原因是把==,<, >,!=之类的全转义了...

    1| 
    2| {{ if list }}
 >> 3| {{ if (type == 'pay' ||  type == 'all') &amp;&amp; !hideStockTips }}
    4| <div class="c"></div>
    5| <div class="alert alert-info mb10 f14" style="border:0 none;">{{ hideStockTips }}温馨提示:避免库存不足影响其他用户下单,待支付订单有效期为:{{floor(ActivityOrderSrv::EXPIRED_TIME / 60)}}分钟,过期需重新下单。</div>
    6| {{ /if }}

CompileError: Unexpected token ;
   generated: if((type == 'pay' ||  type == 'all') &amp;&amp; !hideStockTips){

@isszz
Copy link
Author

isszz commented Jul 17, 2018

我发现从<template></template>里面提取的模板代码,在art-template获取模板内容后会转义...求解决
@aui

@isszz
Copy link
Author

isszz commented Jul 17, 2018

这样的代码会报错...@aui

<template id="J_template">
{{ if str > 1 || str < 0}}
    {{ str }}
{{ /if }}
</template>

@aui
Copy link
Owner

aui commented Jul 19, 2018

在 html 中,<> 字符默认情况下是会被浏览器转义的,你应该注意这个问题,建议采用文档推荐的方式来存放模板。

@aui aui closed this as completed Jul 19, 2018
@isszz
Copy link
Author

isszz commented Jul 19, 2018

好吧,了解了...谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants