Vue路由编程式的导航 以及vue路由History 模式 hash 模式
编程式导航,使用js实现路由跳转
一种跳转方式:
this.$router.push('/news');
this.$router.push('content/499');
另一种跳转方式:
{ path: '/news', component: News, name: 'news'},
this.$router.push({ name: 'news'});
History 模式 hash 模式
//实例化VueRouter
const router = new VueRouter({
mode: 'history', /*hash模式改为history*/
routes //缩写 相当于routes: routes
})
从而实现漂亮的url访问路径