首页 > 其他 > 详细

vue 页面刷新

时间:2018-11-15 10:48:31      阅读:153      评论:0      收藏:0      [点我收藏+]

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(function () {
        this.isRouterAlive = true;
      })
    }
  }
  
}
</script>

需要刷新的页面(lscz.vue)中注册 reload ,调用reload() 方法,

export default {
  components: {
    "v-lsczLeft": lsczLeft
  },
  inject: [‘reload‘],  //注入reload方法
  data() {
    return {
    };
  },
  methods: {
    gdSubmit() {
       this.teload();  //刷新
    }
  }
}

 

vue 页面刷新

原文:https://www.cnblogs.com/miny-simp/p/9962071.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!