1、找到router/index.js
2、在该文件中编辑
// 公共路由
export const constantRoutes = [
编辑跳转
{
path: '/essay',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'essayedit',
component: (resolve) => require(['@/views/system/essayedit/index'], resolve),
name: 'EssayEdit',
meta: { title: '资讯编辑', icon: 'user' }
}
]
},
/
3、在要跳转页面编辑
(我用的是方法跳转)
(1)不传参跳转
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="essayedit()" >文章编辑</el-button>
essayedit() {
this.$router.push({path:'essayedit' })
},
跳转成功!!!
(2)传参跳转
<template slot-scope="scope">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="essayedit(scope.row)" >文章编辑</el-button>
</template>
essayedit(row) {
this.$router.push({path:'essayedit', query: { id: row.essayId } })
},
在接受页面打印出传的内容
created() {
console.log(this.$route.query)
},