一、路由跳轉
this.$router.push('跳轉的url)
二、路由帶參傳值跳轉
- 參數不在地址欄中顯示
例:http://跳轉的URL
const pageValue = {
id: this.id
}
this.$router.push({
path: '頁面的路徑',
name: '頁面的名字',
params: pageValue,
})
- 參數在地址欄中顯示
例: http://跳轉的URL?id=5
const pageValue = {
id: this.id
}
this.$router.push({
path: '頁面的路徑',
name: '頁面的名字',
query: pageValue,
})
三、獲取路由傳的值
id = this.$route.params.id
id = this.$route.query.id