vue class component code example

Example 1: vue class binding

<div v-bind:class="{ active: isActive }"></div>

Example 2: methods vue class component

<template>
  <button v-on:click="hello">Click</button>
</template>

<script>
import Vue from 'vue'
import Component from 'vue-class-component'

@Component
export default class HelloWorld extends Vue {
  // Declared as component method
  hello() {
    console.log('Hello World!')
  }
}
</script>

Example 3: vuejs :class

<div
  class="static"
  v-bind:class="{ active: isActive, 'text-danger': hasError }"
></div>

Tags:

Misc Example