[Vuejs]-How can ı do vue 3 compositon api router refresh page

0👍

if i understand your question correctly you should tie a :key value pair to the component you want to refresh. so essentially when whatever happens in the example function it will increment the change variable which is tied to the component and forces it to refresh.

example –

    <template>
  <div>
   <div @click="example()"> <p>update</p> </div>
    <Component :key="change" />
  </div>
</template>

<script>
import { ref } from "vue";
export default {
  components: {
    Component,
  },
  setup() {
    var change = ref(0);

    function example() {
      
        change.value += 1;
      
    }

    return {
      change,
      example,
    };
  },
};
</script>

Leave a comment