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