vue v-if

vue v-if

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .box {
      width: 200px;
      height: 200px;

      text-align: center;

      border: 1px #000 solid;
    }
  </style>
</head>

<body>

  <div id="app">

    <div v-if="flag" class="box">
      我是v-if控制的盒子
    </div>
  </div>

  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>

  <script>
    const app = new Vue({
      el: '#app',
      data: {

        flag: true,
      }
    })
  </script>


</body>

</html>

vue v-if_第1张图片

你可能感兴趣的:(web_html,javascript)