您应该将JS <script>
标记放在正文的底部以获得最佳效果。我应该为胡子模板做同样的事吗?
e.g。
<html>
<head>
...
</head>
<body>
<h1>Awesome Site</h1>
<div>
Bunch of stuff...
</div>
<script type="text/javascript" src="awesome-app.js"></script>
<!-- should I put this here or does it matter? -->
<script type="text/html" id="mustache-thing">
<div>
{{dynamic_stuff}}
</div>
</script>
</body>
</html>
答案 0 :(得分:0)
是即可。原则是一样的:
允许浏览器首先加载DOM,然后加载
之后的JS