Vue - nextTick

by skirtle

HTML

<div id="app">
  <button @click="onClick">
    Click {{ num }}
  </button>
</div>

Vue

new Vue({
  el: "#app",
  
  data () {
    return {
      num: 0
    }
  },
  
  methods: {
    onClick () {      
      this.num++
      
      this.$nextTick(() => {
        console.log('ticked')
      })
    }
  },
  
  updated () {
    console.log('updated')
  
  }
})