【发布时间】:2018-05-05 17:14:10
【问题描述】:
我正在使用 Vue 生成一些 html 模板,我需要按照下面的代码包含 html 条件 cmets。
var productTemplate = new Vue({
el: '#myApp'
});
<script src="https://unpkg.com/vue@2.5.8/dist/vue.js"></script>
<div id="myApp">
<div class="some-content">
This is some content
</div>
<!--[if mso]>
<div>
this div will only be shown if the condition in the comment is true, in this case the condition is:
if ( mso (microsoft office) == the html rendering engine) {
show the html code between the [if mso] and the [endif]
}
</div>
<![endif]-->
<div class="some-other-content">
This is some content
</div>
</div>
但是当我在浏览器中打开我的 html 页面时,条件注释之间的 html 代码被完全删除,即使我确实需要它。
如何让 Vue 在模板视图中包含这些 cmets?
【问题讨论】:
-
conditional comments表示显示/隐藏? -
分享更多详细信息和两个条件输出的示例?
-
添加了更多细节。
-
@user2486 这些条件 cmets:sitepoint.com/internet-explorer-conditional-comments
-
我不确定 vue 是否有问题:如果您删除 vue 脚本包含,问题是否仍然存在?
标签: html vue.js tags comments conditional-comments