🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## **使用示例** > 参考文档:[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> ```