2
我正在使用underscore.js和主幹爲應用創建一些視圖。這些視圖都具有相同的第一行幾行,但隨後根據它們的子類型而有所不同。有沒有一種有效的方法來組合模板,以便我可以有一個單獨的「主」模板插入到所有其他模板中?underscore.js - 合併模板
代碼示例:
<script type="text/template" id="template-1">
{{ name }}
<span>{{ type }}</span>
<div>
<some view specific html>
</div>
</script>
<script type="text/template" id="template-2">
{{ name }}
<span>{{ type }}</span>
<div>
<some view specific html>
</div>
</script>