<script id="users" type="text/template"> <% if (names.length) { %> <ul> <% names.forEach(function(name){ %> <li> <%= name %> </li> <% }) %> </ul> <% } %> </script> <script> window.onload = function() { var users = document.getElementById('users').innerHTML; var names = ['loki', 'tobi', 'jane']; var html = ejs.render(users, { names: names }); document.getElementById('output').innerHTML = html; } </script>这是ejs的例子,但是测试了一下,发现ie8就不支持ejs了,请问有没有解决办法?
添加回答
举报
0/150
提交
取消