【发布时间】:2021-02-06 15:53:31
【问题描述】:
这是我的路线; http://localhost:3000/homes/California/buy/,我正在尝试使用 vue-router 将路由更改为http://localhost:3000/homes/California/rent/。我试过这样做;
<router-link
:to="{ path: `homes/${this.$route.params.search}/rent/` }"
tag="p"
>
Rent
</router-link>
但它会将路径附加到前一个路径。所以我得到http://localhost:3000/homes/California/buy/homes/California/rent/。
我什至认为它可能是this.$route.params.search,所以我替换了路径; homes/Chicago/buy/,还是不行。我该如何解决?
【问题讨论】:
标签: vue.js url vuejs2 vue-component vue-router