zoukankan      html  css  js  c++  java
  • vue刷新本页面

    顶层app.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>

    要刷新的页面代码

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

    就这样,可以愉快的刷新页面了。此刷新并不会改变vuex状态。

  • 相关阅读:
    前端基础知识1
    mysql作业
    mysql了解知识点
    mysql3
    数据库作业2
    循环结构经典题型
    计算1
    猜数字游戏
    css的显示
    定位和position定位
  • 原文地址:https://www.cnblogs.com/zhuzeliang/p/8872603.html
Copyright © 2011-2022 走看看