Chapter Vue Getting Started - 16 vue bound to the binding element in the style line styles through properties

 

 

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 
 4   <head>
 5     <meta charset="utf-8">
 6     <meta name="viewport" content="width=device-width,initial-scale=1.0">
 7     <title>Document</title>
 8     <!--1.导入Vue的包-->
 9     <script src=" https://cdn.jsdelivr.not / NPM / vue " > </Script >    
10    </ head > 
. 11  
12 is    < body > 
13 is        < div ID = "App" > 
14        <-! object is the unordered set of key-value pairs -> 
15         <-!   <h1 of: style = "{ color: 'red', 'font -weight': 200} "> this is a h1 of </ h1 of>    ->    
16          < h1 of : style =" styleObj1 " > this is a h1 of </ h1 of >    
. 17          < h1 of : style = "[styleObj1, styleObj2]" > this is a h1 of </h1>        
18       </div> 
. 19  
20 is  
21 is        < Script > 
22 is            // Create Vue instance, to give the ViewModel 
23 is            var VM =   new new Vue ({
 24                EL: ' #app ' ,
 25          Data: {
 26 is           styleObj1: {Color: ' Red ' , ' font-weight ' : 200 is },
 27           styleObj2: { ' font-style ' : ' Italic ' }
 28          },
 29         methods:{}
30           });
31       </script>
32   </body>
33 </html>

 

Guess you like

Origin www.cnblogs.com/songsongblue/p/10988196.html