<div id="app">
  <div @click="handleDivClick" :class="{actived: isActived}">
    hello world
  </div>
</div>
.actived {
  color: red;
}
var app = new Vue({
  el: "#app",
  data: {
    isActived: false
  },
  methods: {
    handleDivClick: function () {
      this.isActived = !this.isActived;
    }
  }
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/2.7.8/vue.min.js