多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## **使用示例** > 参考文档:[https://github.com/janl/mustache.js](https://github.com/janl/mustache.js) > 版本:3.1.0 > 代码案例来自:[https://www.jianshu.com/p/c25765c9ebc6](https://www.jianshu.com/p/c25765c9ebc6) ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>mustache.js</title> <script src="../original/Every.js" type="text/javascript" charset="utf-8"></script> <script src="../original/Require.js" type="text/javascript" charset="utf-8"></script> </head> <body> <p> mustache.js </p> <script type="text/javascript"> var data, template, html; data = { name: "Some Tuts+ Sites", sites: ["Nettuts+", " Psdtuts+", "Mobiletuts+"], url: function() { return function(text, render) { text = render(text); var url = text.trim().toLowerCase().split('tuts+')[0] + '.tutsplus.com'; return '<a href="' + url + '">' + text + '</a>'; } } }; template = " \ <h1> {{name}} </h1> \ <ul> {{#sites}} \ <li> {{#url}} {{.}} {{/url}} </li> \ {{/sites}}\ </ul>"; Every.use(['jquery','mustache'], function($,mustache) { var html = mustache.render(template,data); $('p').html(html); }); </script> </body> </html> ```