編程式導(dǎo)航其實就是用javascript來實現(xiàn)頁面之間的跳轉(zhuǎn);
使用下面的方式把同樣可以跳轉(zhuǎn)
this.$router.push({path:'news'});
//傳值。變成 /news? aid =343 在news頁面使用get方式獲取aid
this.$router.push({ path: 'news', query: { aid: '343' }})
也可以寫成命名路由的方式:
this.$router.push({ name: 'news', params: { aid: 123 }});
在編程式路由中name和path不可同時存在