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>