Answers for "vuejs re render component"

3

Vue.js force to reload re-render

this.$forceUpdate();
Posted by: Guest on July-03-2020
0

rerender a vue component

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

export default {
  data() {
    return {
      componentKey: 0
    }
  },
  methods: {
    forceRerender() {
      this.componentKey += 1
    }
  }
}
Posted by: Guest on July-19-2021
0

vue re render v-for

<template>
  <my-component v-if="renderComponent" />
</template>

<script>
  export default {
    data() {
      return {
        // Add boolean which decides render or not
        renderComponent: true,
      };
    },
    methods: {
      forceRerender() {
        // Remove my-component from the DOM
        this.renderComponent = false;

        this.$nextTick(() => {
          // Add the component back in
          this.renderComponent = true;
        });
      }
    }
  };
</script>
Posted by: Guest on July-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language