<div id="app">
  <h1 class="text-center">{{time}}</h1>
</div>
let app=new Vue({
  el: "#app",
  data: {
    timer: null,
    time: 20
  },
  mounted() {
    this.timer=setInterval(this.countdown, 1000);
  },
  methods: {
      countdown() {
        this.time --;
        if(this.time==0){
           clearInterval(this.timer)
         }
      }
    },
  beforeDestroy() {
      clearInterval(this.timer);
    }
})

External CSS

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

External JavaScript

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