一.直接跳转
//js1.this.$router.push(‘/ad_new‘) //html 2.<router-link to="/ad_check"> <div class="top-menu-name">审核</div> </router-link>
二.跳转传参
query传参,参数会显示在url后面?id=? this.$router.push({ path: ‘/member‘, query: { id: id } }) 路由配置 { path: ‘/member‘, name: ‘member‘, component: member } 接收参数 this.$route.query.id
push 直接传参 this.$router.push({ this.$router.push(‘/member/‘+id); }) 路由配置 { path: ‘/member/:id‘, name: ‘member‘, component: member } 接收参数 this.$route.params.id
路由 name this.$router.push({ name: ‘member‘, params: { id: id } }) 路由配置 { path: ‘/member‘, name: ‘member‘, component: member } 接收参数 this.$route.params.id
原文地址:https://www.cnblogs.com/songxuan/p/10249720.html
时间: 2024-10-12 11:38:38