| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | 
							- <!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>
 
-     <style>
 
-         .box {
 
-             width: 100px;
 
-             height: 100px;
 
-             background-color: red;
 
-             margin: 10px;
 
-         }
 
-     </style>
 
- </head>
 
- <body>
 
-     <div id="app">
 
-         <box val="helloworld"></box>
 
-         <box v-bind:val="str"></box>
 
-     </div>
 
-     <template id="box-temp">
 
-         <div class="container">
 
-             <div @click="box1Handle" class="box">
 
-                 <span>{{val}}</span>
 
-             </div>
 
-         </div>
 
-     </template>
 
-    
 
-     <script>
 
-         let app = new Vue({
 
-             el: '#app',
 
-             data: {
 
-                 str:"lovecoding"
 
-             },
 
-             components: {
 
-                 box: {
 
-                     template: "#box-temp",
 
-                     // 组件内部的data是个函数 内部返回一个对象
 
-                     data() {
 
-                         return{
 
-                             num:"abcd"
 
-                         }
 
-                     },
 
-                     // props用来接受传递进来的参数
 
-                     props:["val"],
 
-                     methods: {
 
-                         box1Handle() {
 
-                             console.log(this.val)
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         })
 
-     </script>
 
- </body>
 
- </html>
 
 
  |