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 88<br />
Tip<br />
To actually use a class name instead of a variable inside classes array, use single quotes.<br />
v-bind:class="[ variable, 'classname']"<br />
7.2 Style binding<br />
7.2.1 Object Syntax<br />
The Object syntax for v-bind:style is pretty straightforward; it looks almost like CSS, except it’s a<br />
JavaScript object. We are going to use the shorthand Vue.js provides for the previously used directive,<br />
v-bind(:).<br />
1 <br />
2 <br />
1 data: {<br />
2 niceStyle:<br />
3 {<br />
4 color: 'blue',<br />
5 fontSize: '20px'<br />
6 }<br />
7 }<br />
We can also declare the style properties inside an object :style=”…“ inline.<br />
1 <br />
We can even reference variables inside style object:<br />
1 <br />
2 <br />
3