vue & this.$route & this.$router
vue & this.\(route & this.\)router
const User = {
template: '<div>User</div>'
}
const router = new VueRouter({
routes: [
// dynamic segments start with a colon
{ path: '/user/:id', component: User }
]
})
$route.query
$route.params
$route.query
$route.hash
https://router.vuejs.org/api/#the-route-object
this.$route
读取
// Given a route { path: '/user-*' }
this.$router.push('/user-admin')
this.$route.params.pathMatch // 'admin'
// Given a route { path: '*' }
this.$router.push('/non-existing')
this.$route.params.pathMatch // '/non-existing'
https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route
this.$router
设置
// Given a route { path: '/user-*' }
this.$router.push('/user-admin')
this.$route.params.pathMatch // 'admin'
// Given a route { path: '*' }
this.$router.push('/non-existing')
this.$route.params.pathMatch // '/non-existing'
https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14305628.html
未经授权禁止转载,违者必究!