Skip to content

cloverso/templatejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

template

简易 JavaScrpt DOM 模板引擎

使用方法: 详情请查看源码;

<script src="xxxx/template.js"></script> <script id="ul-template" type="text/template"> <% data.forEach(funcntion(item){ %>
  • <%= item.text %>
  • <% }) %> </script> <script> var ulData = [ { className: 'class1', text: 'text1' }, { className: 'class2', text: 'text2' }, { className: 'class3', text: 'text3' } ]; var ul = document.getElementById('ul'), ulTemplate = document.getElementById('ul-template'); ul.innterHTML = template(ulTemplate.innerHTML, ulData); </script>

    About

    简易 JavaScrpt DOM 模板引擎

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published