這是我的html:如何在HTML中定義鬍鬚部分?
<script type="text/html" id="ul-template">
<ul id="list">
{{> li-templ}}
</ul>
</script>
<script type="text/html" id="ul-template2">
<div id="list2">
{{> li-templ}}
</div>
</script>
<script type="text/html" id="li-templ">
<p>{{ name }}</p>
</script>
,你可以看到,我想重用#li-templ
一部分,但似乎我必須把它寫入到一個名爲li-templ.mustache
文件,然後我可以把它作爲partial
?
我可以在單個html文件中定義它們嗎?
你好,這是值得注意的是'Mustache.to_html'已經被替換爲'Mustache.render'(函數定義保持不變) – Matt
難道只是我,或者是以下中的嵌入式這樣的模板鏈接谷歌博特?難道是由於TYPE =「text/html的」條目?會是使用類似的結果:type =「text/mustache-template」? – pointernil
由於Mustache是來自github,因爲MIME類型是文本,所以沒有更多的執行,[這裏](http://jsfiddle.net/anandchakru/19z7gf6n/)是一個修改的小提琴,以防有人想要參考。 –