<bdo id='AShHp'></bdo><ul id='AShHp'></ul>

      <tfoot id='AShHp'></tfoot>

      <legend id='AShHp'><style id='AShHp'><dir id='AShHp'><q id='AShHp'></q></dir></style></legend>

        <small id='AShHp'></small><noframes id='AShHp'>

      1. <i id='AShHp'><tr id='AShHp'><dt id='AShHp'><q id='AShHp'><span id='AShHp'><b id='AShHp'><form id='AShHp'><ins id='AShHp'></ins><ul id='AShHp'></ul><sub id='AShHp'></sub></form><legend id='AShHp'></legend><bdo id='AShHp'><pre id='AShHp'><center id='AShHp'></center></pre></bdo></b><th id='AShHp'></th></span></q></dt></tr></i><div id='AShHp'><tfoot id='AShHp'></tfoot><dl id='AShHp'><fieldset id='AShHp'></fieldset></dl></div>

        Vue html 注释处理

        Vue html comment handling(Vue html 注释处理)
        <tfoot id='7oq7n'></tfoot><legend id='7oq7n'><style id='7oq7n'><dir id='7oq7n'><q id='7oq7n'></q></dir></style></legend>

        • <i id='7oq7n'><tr id='7oq7n'><dt id='7oq7n'><q id='7oq7n'><span id='7oq7n'><b id='7oq7n'><form id='7oq7n'><ins id='7oq7n'></ins><ul id='7oq7n'></ul><sub id='7oq7n'></sub></form><legend id='7oq7n'></legend><bdo id='7oq7n'><pre id='7oq7n'><center id='7oq7n'></center></pre></bdo></b><th id='7oq7n'></th></span></q></dt></tr></i><div id='7oq7n'><tfoot id='7oq7n'></tfoot><dl id='7oq7n'><fieldset id='7oq7n'></fieldset></dl></div>
              <bdo id='7oq7n'></bdo><ul id='7oq7n'></ul>
              • <small id='7oq7n'></small><noframes id='7oq7n'>

                  <tbody id='7oq7n'></tbody>

                  本文介绍了Vue html 注释处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Vue 生成一些 html 模板,我需要按照下面的代码包含 html 条件注释.

                  var productTemplate = new Vue({埃尔:'#myApp'});

                  <script src="https://unpkg.com/vue@2.5.8/dist/vue.js"></脚本><div id="myApp"><div class="一些内容">这是一些内容</div><!--[if mso]>

                  只有当评论中的条件为真时才会显示此 div,在这种情况下,条件是:if ( mso (microsoft office) == html 渲染引擎) {显示 [if mso] 和 [endif] 之间的 html 代码}</div><![endif]--><div class="其他内容">这是一些内容</div></div>

                  但是当我在浏览器中打开我的 html 页面时,条件注释之间的 html 代码被完全删除,即使我确实需要它.

                  如何让 Vue 在模板视图中包含这些注释?

                  解决方案

                  在 Vue 2.4.0+ 中,你可以设置 comments 如果你想在组件的模板中保留注释,则在组件内设置 true 选项.

                  var productTemplate = new Vue({comments: true,//<-- 添加这个埃尔:'#myApp'});

                  I'm using Vue to produce some html template, I need to include the html conditional comments as per code below.

                  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>

                  But when I open my html page in the browser the html code between the conditional comment is completely removed even though I actually need it to be there.

                  How can I make Vue include these comments in the template's view?

                  解决方案

                  In Vue 2.4.0+, you can set the comments option to true inside the component if you want to preserve comments in the component's template.

                  var productTemplate = new Vue({
                      comments: true,  // <-- Add this
                      el: '#myApp'
                  });
                  

                  这篇关于Vue html 注释处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Embed YouTube video - Refused to display in a frame because it set #39;X-Frame-Options#39; to #39;SAMEORIGIN#39;(嵌入 YouTube 视频 - 拒绝显示在框架中,因为它将“X-Frame-Options设置为“SAMEORIGIN)
                  Stop embedded youtube iframe?(停止嵌入 youtube iframe?)
                  YouTube iframe API: how do I control an iframe player that#39;s already in the HTML?(YouTube iframe API:如何控制 HTML 中已有的 iframe 播放器?)
                  Switch/toggle div (jQuery)(切换/切换 div (jQuery))
                  How to avoid name clashes in JavaScript widgets(如何避免 JavaScript 小部件中的名称冲突)
                  Widget -what to do and what not(小部件 - 做什么和不做什么)
                  <i id='PHvEh'><tr id='PHvEh'><dt id='PHvEh'><q id='PHvEh'><span id='PHvEh'><b id='PHvEh'><form id='PHvEh'><ins id='PHvEh'></ins><ul id='PHvEh'></ul><sub id='PHvEh'></sub></form><legend id='PHvEh'></legend><bdo id='PHvEh'><pre id='PHvEh'><center id='PHvEh'></center></pre></bdo></b><th id='PHvEh'></th></span></q></dt></tr></i><div id='PHvEh'><tfoot id='PHvEh'></tfoot><dl id='PHvEh'><fieldset id='PHvEh'></fieldset></dl></div>
                      <tbody id='PHvEh'></tbody>
                      <bdo id='PHvEh'></bdo><ul id='PHvEh'></ul>

                    • <tfoot id='PHvEh'></tfoot>
                    • <small id='PHvEh'></small><noframes id='PHvEh'>

                            <legend id='PHvEh'><style id='PHvEh'><dir id='PHvEh'><q id='PHvEh'></q></dir></style></legend>