点击跳转按钮,触发事件
路径要和router中的匹配
handleEdit(row) {
this.$router.push('/project/project-detail/' + row.id)
}
router配置
import Layout from '@/layout'
const projectRouter = {
path: '/project',
component: Layout,
redirect: '/project/all-project',
name: '项目管理',
meta: {
title: '项目管理',
icon: 'project'
},
children: [
{
path: 'project-list',
component: () => import('@/views/project/index'),
name: '项目列表',
meta: { title: '项目列表' }
},
{
path: 'project-detail/:id',
component: () => import('@/views/project/project-details'),
name: '项目详情',
meta: { title: '项目详情' },
hidden: true
}
]
}
export default projectRouter
新页面获取点击事件传的值
<template>
<div>
项目详情
</div>
</template>
<script>
export default {
name: 'ProjectDetails',
inject: ['reload'],
data() {
return {
id: ''
}
},
created() {
this.id = this.$route.params.id
},
methods: {
}
}
</script>
<style scoped>
</style>