| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- <!DOCTYPE html>
 
- <html lang="en">
 
- <head>
 
-     <meta charset="UTF-8">
 
-     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
-     <title>Document</title>
 
-     <script src="./js/vue.js"></script>
 
- </head>
 
- <body>
 
-     <div id="app">
 
-         <h1>
 
-             {{num1}} + {{num2}} = {{sum}}
 
-         </h1>
 
-         <button @click="changeFun">change</button>
 
-         <h1>{{sum2}}</h1>
 
-     </div>
 
-     <script>
 
-         let app = new Vue({
 
-             el: '#app',
 
-             data:{
 
-                 num1:1,
 
-                 num2:2
 
-             },
 
-             methods: {
 
-                 changeFun:function(){
 
-                     // this.num2 = 100;
 
-                     this.sum2 = 1000;
 
-                 }
 
-             },
 
-             computed:{
 
-                 sum:function(){
 
-                     console.log("computed运行")
 
-                     let thisSum = this.num1 + this.num2;
 
-                     return thisSum;
 
-                 },
 
-                 sum2:{
 
-                     get(){
 
-                         console.log("get");
 
-                         return this.num1 + this.num2;
 
-                     },
 
-                     set(val){
 
-                         console.log(val);
 
-                         console.log("set")
 
-                         this.num1 = 998
 
-                     }
 
-                 }
 
-             }
 
-         })
 
-     </script>
 
- </body>
 
- </html>
 
 
  |