08.02.2017 Views

vuejs

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Class and Style Bindings 89<br />

Style object binding<br />

It is often a good idea to use a style object and bind it, so the template is cleaner.<br />

7.2.2 Array Syntax<br />

Using inline array syntax for v-bind:style, we are able to apply multiple style objects to the same<br />

element, meaning here that every list item is going to have the color and fontsize of niceStyle<br />

and the font weight of badStyle.<br />

1 <br />

2 <br />

1 data: {<br />

2 niceStyle:<br />

3 {<br />

4 color: 'blue',<br />

5 fontSize: '20px'<br />

6 }<br />

7 badStyle:<br />

8 {<br />

9 fontweight: 'bold'<br />

10 }<br />

11 }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!