第一个方法是:将数据存到storage外面,之后在新页面取出来
第二个方法,也是我这里要说的方法,像这样写:
跳路由时把数据附带下来
this.$router.push('/admin/personnel/custom-detail/' + item.id)
能够看到,前面携带了数据 item.id
在api外面配置好要接管的数据:
{ path: '/admin/personnel/custom-detail/:id', meta: { title: 'xxx', breadcrumb: 'xxx/xxx/xxx' }, component: () => import('views/personnel/custom/detail/page.vue')},
能够看到,在 path 中我增加了 /:id
之后就能够在新页面接管信息了:
this.$route.params.id
应用$route.params能够获取到导航栏携带的数据
再将数据存到data外面,这样就OK了