JavaScript模板引擎template.js.zip

时间:2022-08-06 22:29:16
【文件属性】:
文件名称:JavaScript模板引擎template.js.zip
文件大小:390KB
文件格式:JS
更新时间:2022-08-06 22:29:16
开源项目 template.js 一款 JavaScript 模板引擎,简单,好用。提供一套模板语法,用户可以写一个模板区块,每次根据传入的数据,生成对应数据产生的HTML片段,渲染不同的效果。特性:模版编译,渲染支持所有主流浏览器及Node(UMD)JavaScript原生语法可自定义配置支持数据过滤功能专一,简单好用兼容性:Node 0.10 Safari 6 (Mac)iOS 5 SafariChrome 23 (Windows, Mac, Android, iOS, Linux, Chrome OS)Firefox 4 (Windows, Mac, Android, Linux, Firefox OS)Internet Explorer 6 (Windows, Windows Phone)Opera 10 (Windows, linux, Android)编写模版使用一个type="text/html"的script标签存放模板,或者放到字符串中:[removed]
        <%for(var i = 0; i < list.length; i ) {%>     
  • <%:=list[i].name%>
  •     <%}%>
[removed]渲染模板var tpl = document.getElementById('tpl')[removed]; template(tpl, {list: [{name: "yan"},{name: "haijing"}]});输出结果:
        
  • yan
  •     
  • haijing
标签:template
【文件预览】:
template.js-master
----MIT-LICENSE.txt(1KB)
----bower.json(520B)
----template.js(9KB)
----README.zh-CN.md(4KB)
----.npmignore(103B)
----demo()
--------child-template.html(2KB)
--------config.html(1KB)
--------requirejs.html(519B)
--------registerFunction.html(2KB)
--------js()
--------node()
--------registerModifier.html(781B)
--------basic.html(1KB)
----doc()
--------api.md(3KB)
----TODO.md(224B)
----.travis.yml(121B)
----test()
--------speed4.html(7KB)
--------compile-time.html(1KB)
--------js()
--------speed2.html(7KB)
--------test.js(4KB)
--------render-time.html(2KB)
--------browser()
--------joinVSconcat.html(2KB)
--------compile-error.html(539B)
--------speed3.html(7KB)
--------render-error.html(532B)
--------speed1.html(11KB)
----README.md(4KB)
----temp.html(1KB)
----.gitignore(24B)
----CHANGELOG.md(1KB)
----package-lock.json(326B)
----package.json(985B)

网友评论