<div id="app">
  <button :class="['btn', isError ? 'btn-danger' : 'btn-success']" @click="isError = !isError">Submit</button>
</div>
var vue = new Vue({
  el: "#app",
  data: {
    isError: false
  }
});

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css

External JavaScript

  1. https://cdn.jsdelivr.net/npm/vue/dist/vue.js