1<template>
2 <component-to-re-render :key="componentKey" />
3</template>
4
5export default {
6 data() {
7 return {
8 componentKey: 0,
9 };
10 },
11 methods: {
12 forceRerender() {
13 this.componentKey += 1;
14 }
15 }
16}
1<template>
2 <my-component v-if="renderComponent" />
3</template>
4
5<script>
6 export default {
7 data() {
8 return {
9 // Add boolean which decides render or not
10 renderComponent: true,
11 };
12 },
13 methods: {
14 forceRerender() {
15 // Remove my-component from the DOM
16 this.renderComponent = false;
17
18 this.$nextTick(() => {
19 // Add the component back in
20 this.renderComponent = true;
21 });
22 }
23 }
24 };
25</script>