Use template engine

1, the import file

<script src="template-web.js"></script>

2, custom templates

<script type="text/html" id="template">

  <! - these tags are not displayed on the page, but it is real, this is the template ->

    <ul>

      <Li> Name: {{name}} </ li> needed to fill the data package using {} {}

       <Li> Gender: {{gender}} </ li>

     </ul>

</script>、

3, ready to objects (data needs to be filled)

4, the fill data to the Template

   template (template ID, fill data pits)

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/qqinhappyhappy/p/11837497.html
Recommended