前端页面scope.row.id为2c440786a715877ecd4

<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <router-link :to="`/system/dict-data/index/${scope.row.id}` " class="link-type">
            <span>{{ scope.row.dictType }}</span>
          </router-link>
        </template>
      </el-table-column>

route中的路由

{
    path: '/system/dict-data',
    component: Layout,
    hidden: true,
    permissions: ['system:dict:list'],
    children: [
      {
        path: 'index/:id(\\w+)', //d是数字,需要把\\d+换成w+
        component: () => import('@/views/system/dict/data'),
        name: 'Data',
        meta: { title: '字典数据', activeMenu: '/system/dict' }
      }
    ]
  }

如果不把\\d+换成\\w+就会出现404

在这里插入图片描述

在需要跳转到的页面接收 取的id为路由中的id

created() {
    const dictId = this.$route.params && this.$route.params.id;
  }
Logo

快速构建 Web 应用程序

更多推荐