二、Vue实例中的数据,事件和方法

1、v-html指令和v-text指令

v-html :不转义

v-text :转义过后的内容

    <div id="root">
        <div v-html="content"></div>
        <div v-text="content"></div>
    </div>
    <script>
    new Vue({
        el:"#root",
        data:{
            content:"<h1>hello</h1>"
        }
    })
    </script>
View Code

相关文章:

  • 2022-12-23
  • 2021-12-07
  • 2021-07-08
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-28
  • 2022-12-23
  • 2021-06-19
  • 2021-06-02
相关资源
相似解决方案