首页 > 其他分享 >v-memo的代码

v-memo的代码

时间:2022-08-16 14:58:21浏览次数:39  
标签:function 代码 name app height age memo

<body>

  <div id="app">
    <div v-memo="[name, age]">
      <h2>姓名: {{ name }}</h2>
      <h2>年龄: {{ age }}</h2>
      <h2>身高: {{ height }}</h2>
    </div>
    <button @click="updateInfo">改变信息</button>
  </div>
  
  <script src="../lib/vue.js"></script>
  <script>
    // 1.创建app
    const app = Vue.createApp({
      // data: option api
      data: function() {
        return {
          name: "why",
          age: 18,
          height: 1.88
        }
      },

      methods: {
        updateInfo: function() {
          // this.name = "kobe"
          this.age = 20
        }
      }
    })

    // 2.挂载app
    app.mount("#app")
  </script>
</body>

 

标签:function,代码,name,app,height,age,memo
From: https://www.cnblogs.com/qd-lbxx/p/16591566.html

相关文章