vue刷新本頁面

頂層app.vue頁面vue

<template>
  <div id="app">
    <router-view v-if="isRouterAlive"></router-view>
  </div>
</template>
<script> export default { name: 'App', provide() { return { reload: this.reload } }, data() { return { isRouterAlive: true } }, methods: { reload() { this.isRouterAlive = false
      this.$nextTick(() => (this.isRouterAlive = true)) } } } </script>

要刷新的頁面代碼vuex

export default { inject: ['reload'], data() { return { } }, methods: { handleReload(){ this.reload(); } }, } 

就這樣,能夠愉快的刷新頁面了。此刷新並不會改變vuex狀態。app

相關文章
相關標籤/搜索