如何通过api在vue js路由器中获取数据通过另一页

问题描述 投票:0回答:1
axios.get('http://127.0.0.1:8000/api/filter-trip?fromlocation='+this.form.from_place+'&tolocation='+this.form.to_place+'&assign_date='+DatabaseFormat+'',auth)
                .then(response => {
                    this.FilterTripData = response.data
                   console.log(this.FilterTripData)
                   this.$router.push({ path : '/search-bus', params: {
                           items: this.FilterTripData
                       }});
                  })
                .catch(error => {console.log(error)});
    } 

Pass Api如何通过Router Push获取数据并在另一页上访问这些数据

vue.js
1个回答
1
投票
this.$router.push({ path : '/search-bus', params: {
                       items: this.FilterTripData
                   }});

这已经是正确的。要在另一个页面中访问它。

this.$router.currentRoute.params.items
© www.soinside.com 2019 - 2024. All rights reserved.