Objective:
In the analysis of the Jeesite project, saw the mustache, so checked the next
Body:
1. Mustache Overview
Mustache is a JavaScript-based template engine for rendering foreground pages, lightweight, easy to use syntax
2. How to use Mustache
1) Download Mustache.js and Jquery.js (get on Git hub) online, and introduce it in the page
2) Simple Object binding display
Code Show:
<script>$ (function () { = {name: "Panie", Age:25,sex: "Girl"}; = "My name is {{name}},i ' m {{age}},sex}}"; = Mustache.render (template,user); $ ("#userinfo"). HTML (view);}); </script>
Page Rendering Effect:
Syntax Explanation:
I. Mustache's syntax is simple, use two curly braces to mark the field you want to bind to, "{{}}";
II. The field name within the curly braces is the same as the property name of the object in the second argument in the Mustache.render method
III. The main rendering method is Mustache.render, the method has two parameters, the first is to render the template, that is, the template in the above example, the second is the data source is the user object in the above example
Reference Link: http://blog.csdn.net/xuemoyao/article/details/17896203
Mustache Usage Summary