3gw*_*ain 10 mustache handlebars.js
在我的Mustache模板中,我想评论几行,但我无法做到.我仍然在HTML中显示评论.添加评论的正确方法是什么?有人可以帮我解决这个问题吗?
这是我的代码:
<script type="text/html" id="inspector-splitViewBase">
<div class="inspector-split-view-container flex-1 flex-fill flex-down">
<header class='split-view-inspector-header'>
<div class="view-title">Source Assets</div>
{{!-- <div class="actions"> commented
<span class="label">Actions</span>
<span class="gear"></span>
</div> --}} - comment is not working
</header>
<div class='search-container'>
<span class="search-icon"></span>
<input type="text" value="" class="inspector-search" />
</div>
<div class="source-assets-list-container flex-1"></div>
<footer></footer>
</div>
</script>
Run Code Online (Sandbox Code Playgroud)
Wal*_*rer 13
Mustache 文档建议使用以下注释:
Comments begin with a bang and are ignored. The following template:
<h1>Today{{! ignore me }}.</h1>
Will render as follows:
<h1>Today.</h1>
Comments may contain newlines.
Run Code Online (Sandbox Code Playgroud)
我认为在你的情况下你必须使用
{{! blah }}
Run Code Online (Sandbox Code Playgroud)
代替
{{!-- blah --}}
Run Code Online (Sandbox Code Playgroud)