Day3.12 data components and methods

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>12</title>
 6     <script src="../lib/js/vue.js"></script>
 7 </head>
 8 <body>
 9 <div id="app">
MyCom<10     > </ MYCOM > 
. 11  </ div > 
12 is  < Script > 
13 is      / * *
 14       * 1. assembly can have its own data Data
 15       * 2. Examples of data and data components are not the same, the data can be an example of a Object
 16       * and the assembly must be a method of data
 17       * 3. the assembly must be other than a data addition method, the method further inside must return an object
 18 is       * data and use the data in example 4. the assembly of the use exactly the same data
 . 19       * / 
20 is      Vue.component ( ' MYCOM ' , {
 21 is          Template: " <h1 of> this is the global components - - - MSG {} {} </ h1 of> " ,
 22 is         data: function () {
 23 is              return {
 24                  MSG: ' This is the data component of the data defined in the ' 
25              }
 26 is          }
 27      });
 28      const VM =  new new Vue ({
 29          EL: ' #app ' ,
 30          data: {
 31 is          },
 32          Methods: {
 33 is          }
 34 is      })
 35  </ Script > 
36  </ body >
37 </html>

Guess you like

Origin www.cnblogs.com/zhaohui-116/p/12057322.html