对模板的理解:
赋值,结构语句,布局,过滤,扩展助手。
看一个模板好不好用,其中最主要两点是布局和扩展。
xtemplate
地址:http://docs.spmjs.io/xtemplate/latest/
一般需要使用到他的api
xtpl: https://github.com/xtemplate/xtpl
上面两个要配合使用,xtemplate提供api操作,然后xtpl处理后缀为xtpl的文件渲染。
这个模板比较适合php后端从smaty做过来的人使用。
腾讯artTemplate
地址: https://aui.github.io/art-template/zh-cn/docs/syntax.html
上两个都是傻瓜式操作,基本满足需求,特殊场景没遇到过。
handlebars
地址: https://handlebarsjs.com/zh/guide
配合handlebars-helpers和handlebars-layouts 使用
handlebars大而全,使用起来稍微比较复杂一点。自定义helpers使其在任何特殊场景都能够胜任。
不够使用可以查看github上的Handlebars in the Wild列表