daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### v-bind:class
  2.  
  3. ```
  4. <div v-bind:class="classObject"></div>
  5.  
  6. data: {
  7.   isActive: true,
  8.   error: null
  9. },
  10. computed: {
  11.   classObject: function () {
  12.     return {
  13.       active: this.isActive && !this.error,
  14.       'text-danger': this.error && this.error.type === 'fatal'
  15.     }
  16.   }
  17. }
  18. ```
  19.  
  20. > putting classes in an array
  21. ```
  22. <div v-bind:class="[isActive ? activeClass : '', errorClass]"></div>
  23. ```
  24.  
  25. ### v-bind:style
  26. ```
  27. <div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }"></div>
  28. <div v-bind:style="[baseStyles, overridingStyles]"></div>
  29. ```
RAW Paste Data
Top