對模板的理解:
賦值,結構語句,佈局,過濾,擴展助手。
看一個模板好不好用,其中最主要兩點是佈局和擴展。
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列表