Vue跳转相同路由不同参数,解决页面数据不自动刷新


参考:

https://www.cnblogs.com/ainyi/p/9340311.html

https://blog.csdn.net/weixin_41888813/article/details/86735664

  created() {
    this.fetchLink()
  },

  watch: {
    // 监听相同路由下参数变化的时候,从而实现异步刷新
    '$route'(to,from) {
      // 做一些路由变化的响应
      this.loading = true;
      this.fetchLink()
    }
  },

  methods: {
    fetchLink(){
      resourcemgApi.zypriceSearch(this.$route.params.name).then(resp => [
        this.list = resp.data,
        console.log(this.list)
      ])
    }
  },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM