在我的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>
解决方法
Mustache
documentation建议使用以下评论:
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.
我认为在你的情况下你必须使用
{{! blah }}
代替
{{!-- blah --}}