1.router/index.vue增加路由

{
  path: '/system/report/detail/',
  component: Layout,
  hidden: true,
  permissions: ['system:report:query'],
  children: [
    {
      path: ':reportId(\\d+)',
      component: () => import('@/views/system/report/detail'),
      name: 'Report_Detail',
      meta: { title: '报告详情', activeMenu: '/system/report' }
    }
  ]
}

2.点击按钮弹出新页面

const reportId = row.reportId || 0;
router.push('/system/report/detail/' + reportId);

3.新页面,获取传递过来的参数

let params = window.location.pathname.split('/')[4];

4.把参数放到函数接口里面去调用,例如

proxy.$modal.loading("正在加载缓存监控数据,请稍候!");
let params = window.location.pathname.split('/')[4];
console.log(params);
getReport(params,queryParams.value).then(response => {
  proxy.$modal.closeLoading();
})
Logo

快速构建 Web 应用程序

更多推荐