您的位置:首页 > Web前端 > JavaScript

dot.js

2016-06-17 18:34 387 查看
{{ }} for evaluation

{{= }} for interpolation

{{! }} for interpolation with encoding

{{# }} for compile-time evaluation/includes and partials

{{## #}} for compile-time defines

{{? }} for conditionals

{{~ }} for array iteration

{{=it.xx}} 取obj.xx的值

{{ }} 里面放if else / for 等表达式

{{!it.xx}} 取把obj.xx转义后的值

1,{{? typeof it[prop]==’object’ }} 表示条件判断,结束标签是{{?}} 

2, {{?? }}是条件判断的else 

3,{{ 和{{? 中均可以使用原生的js语法,如for,typeof 等 

4,模板并不是一定要放在script标签中,也可以放在隐藏的div标签中

使用方法:

{{= }} for 赋值

{{ }} for evaluation

{{~ }} for for循环数组

{{? }} for if判断

{{! }} for html标签是否转义

{{# }} for compile-time evaluation/includes and partials

{{## #}} for compile-time defines
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: