Key-changing re-render VueJS

by Alen Subasic

HTML

<template>
  <component-to-re-render :key="componentKey" />
</template>

Vue

var vm = new Vue({
  data() {
    return {
      componentKey: 0,
    };
  },
  methods: {
    forceRerender() {
      this.componentKey += 1;
    }
  }
});