标签:重定向 ret data- amp console ref export ted span
<div>房间号:{{$route.params.id}}</div>
<div>成员Id:{{$route.params.mum_id}}</div>
routes: [{ path:‘/home/:id/number/:mum_id‘, name:‘home‘, component: Home }]
watch: {
$route(to,from) {
console.log(to)
console.log(from)
}
}
{ path:‘*‘, redirect:‘/home‘ } { path:‘*‘, redirect:{name:‘home‘} } { path:‘*‘, redirect(to) { if(to.path === ‘/‘) { return ‘/home‘ }else { return {path:‘/err‘} } } }
嵌套路由
命名视图
export default new VueRouter({ routes: [ { path:‘/home/:id?‘, name:‘home‘, component: Home } ], }) <template> <div> <div>我是{{title}}</div> <div>房间号:{{$route.params}}</div> </div> </template> <script> import Home from ‘../components/home‘ export default { data() { return { title: ‘HOME‘ } } } </script>
标签:重定向 ret data- amp console ref export ted span
原文地址:https://www.cnblogs.com/goff-mi/p/9392392.html