Vue study notes [2] - The command Vue - v-cloak, v-text and v-html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    [v-cloak] {
      /* display: none; */
    }
  </style>
</head>
<body>
  <div id="app">
    <-! Using v-cloak can solve the problem of flicker interpolation expression ->
    <p v-cloak>++++++++ {{ msg }} ----------</p>
    <h4 v-text="msg">==================</h4>
    <! - Default v-text is not flashing problem ->
    <-! V-text elements will be covered in the original content, but interpolation expression {{}} will only replace its placeholder, not empty the entire contents of elements ->
    <div>{{msg2}}</div>
    <div v-text="msg2"></div>
    <div v-html="msg2">1212112</div>
  </div>
  <script src="./lib/vue-2.4.0.js"></script>
  <script>
    was vm = new Vue ({
      on: '#app' ,
      data: {
        msg: '123',
        msg2: '<h1> Haha, I was a big H1, I am, I am proud </ h1>' ,
      }
    })
  </script>
</body>
</html>

 

Guess you like

Origin www.cnblogs.com/superjishere/p/11864600.html