{{ }} 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
最后
以上就是单纯芒果最近收集整理的关于dot.js的全部内容,更多相关dot内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复