Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### v-bind:class
- ```
- <div v-bind:class="classObject"></div>
- data: {
- isActive: true,
- error: null
- },
- computed: {
- classObject: function () {
- return {
- active: this.isActive && !this.error,
- 'text-danger': this.error && this.error.type === 'fatal'
- }
- }
- }
- ```
- > putting classes in an array
- ```
- <div v-bind:class="[isActive ? activeClass : '', errorClass]"></div>
- ```
- ### v-bind:style
- ```
- <div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }"></div>
- <div v-bind:style="[baseStyles, overridingStyles]"></div>
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement