vue 2.0 和3.0

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .hh{
      line-height: 60px;
    }
  </style>
</head>
<body>
  <div id="app">
    <h3 style="background-color: red;" :style="{color,height}" :class="{hh}">{{msg}}</h3>
  </div>
  <script src="https://unpkg.com/vue@next"></script>
  <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
  <script>
    /*vue2.0
     const app=new Vue({
       el: "#app",
       data: {
         msg:"this is vue2.0  msg"
       }
     })
     */
    //vue3.0
    const app=Vue.createApp({
      data() {
        return {
          msg:"this is vue3.0 msg",
          color:'green',
          height:'60px',
          hh:true,

        }
      }
    }).mount("#app");
  </script>
</body>
</html>

 

posted @ 2021-03-02 13:50  howhy  阅读(25)  评论(0)    收藏  举报