router-link (3) pigx单体 路由跳转
1.src/router 下 route.ts 加入前端静态路由
dynamicRoutes: 这里是跳转后带菜单的
{
path: '/pro/proProjectTaskAcceptance/index.vue',
name: '项目验收',
component: () => import('/@/views/pro/proProjectTaskAcceptance/index.vue'),
meta: {
isHide: true,
},
},
staticRoutes:这里跳转后没有菜单,单一页面
{
path: '/eo1',
name: 'staticRoutes.eo1',
component: () => import('/@/views/pro/proProjectTaskAcceptance/index.vue'),
meta: {
isAuth: false,
},
},
2.页面调用
import router from '/@/router';
方式1:
const btnContant = ()=>{
console.log('btnContant')
// <router-link to="/pro/projectcontant/index">合同审核</router-link>
router.push({
path: '/pro/projectcontant/index',
query: {
context: '吴又可吴又可'
}
});
}
方式2:
const btnAcceptance = ()=>{
console.log('btnAcceptance')
// <router-link to="/pro/proProjectTaskAcceptance/index">项目验收审核</router-link>
router.push({
name: '项目验收',
params: {
context: '吴又可吴又可',
id: 2,
name: '我呢'
}
});
console.log(router)
}
3.页面取值
import router from '/@/router';
onMounted(()=>{
// console.log(router.currentRoute.value.query.context )
console.log(router )
})
择善人而交,择善书而读,择善言而听,择善行而从。