新建一个页面的流程
一. 在原来的文件夹中添加一个新的页面:
比如在product文件夹下新建一个商品保障服务的页面productGuarantee
- 首先在views目录下的product文件夹下面新建一个文件夹productGuarantee,再在该文件夹下新建一个index.vue文件
- 然后找到router文件夹下moudles下的product.js文件,在该文件下面加入你新加的页面要跳转的链接和页面地址
{
path: 'guarantee',
name: 'ProductGuarantee',
meta: {
title: '保障服务',
noCache: true
},
component: () => import('@/views/product/productGuarantee/index.vue')
}
二. 在views下面添加新的文件夹,并添加新的页面,比如现在在views下面添加一个station文件夹
- 首先在views下新建station文件夹,并在station下新建notice文件夹和Index.vue文件
- 然后在router文件夹下的moudles文件夹下新建station.js,声明stationRouter然后导出
import Layout from '@/layout'
import { roterPre } from '@/settings'
const stationRouter =
{
path: `${roterPre}/station`,
name: 'station',
meta: {
icon: '',
title: '公告列表'
},
alwaysShow: true,
component: Layout,
children: [
{
path: 'notice',
name: 'stationNotice',
meta: {
title: '公告列表'
},
component: () => import('@/views/station/notice/index')
}
]
}
export default stationRouter
- 在router文件夹下的Index.js中导入