博客
关于我
实际前端项目路由配置
阅读量:203 次
发布时间:2019-02-28

本文共 1658 字,大约阅读时间需要 5 分钟。

Vue项目开发指南

一、组件定义

1. 创建Vue组件

src/views文件夹下创建以下文件夹和文件:

  • 创建src/views/teacher文件夹
  • src/views/teacher下创建form.vuelist.vue两个组件文件

2. 组件代码示例

二、路由定义

修改src/router/index.js文件,重新定义constantRouterMap

export const constantRouterMap = [  {    path: '/login',    component: () => import('@/views/login/index'),    hidden: true  },  {    path: '/404',    component: () => import('@/views/404'),    hidden: true  },  {    path: '/',    component: Layout,    redirect: '/dashboard',    name: 'Dashboard',    hidden: true,    children: [{      path: 'dashboard',      component: () => import('@/views/dashboard/index')    }]  },  // 讲师管理  {    path: '/teacher',    component: Layout,    redirect: '/teacher/list',    name: 'Teacher',    meta: { title: '讲师管理' },    children: [      {        path: 'list',        name: 'TeacherList',        component: () => import('@/views/teacher/list'),        meta: { title: '讲师列表' }      },      {        path: 'create',        name: 'TeacherCreate',        component: () => import('@/views/teacher/form'),        meta: { title: '添加讲师' }      },      {        path: 'edit/:id',        name: 'TeacherEdit',        component: () => import('@/views/teacher/form'),        meta: { title: '编辑讲师' },        hidden: true      }    ]  },  {    path: '*',    redirect: '/404',    hidden: true  }]

三、项目其他配置

1. 项目名称

vue-admin-template-master重命名为guli_admin

2. 端口号

config/index.js中修改

port: 9528,
3. 国际化设置

src/main.js中第7行修改语言为zh-CN

import locale from 'element-ui/lib/locale/lang/zh-CN'
4. 入口页面

index.html

谷粒学院后台管理系统
5. 登录页

src/views/login/index.vue第4行

谷粒学院后台管理系统

转载地址:http://uqqj.baihongyu.com/

你可能感兴趣的文章
Python 子进程 Popen:为什么会出现“ls *.txt“?不行?
查看>>
Python 子进程参数
查看>>
python 字典 key 和value 互换
查看>>
Python 字典 vs If 语句速度
查看>>
python 字典sorted自定义排序,按照key or value排序
查看>>
python 字典和列表区别_元组列表和字典的主要区别是什么?
查看>>
python 字符串中特定字符替换,截取
查看>>
Python 字符串总结
查看>>
python 字符串显示中文_Python字符串开头的b"、u"、r"与中文乱码
查看>>
Python 字符串的几种拼装方式
查看>>
python 存入数据库bigint_python基础_MySQL的bigint类型
查看>>
python 学习 面向对象编程
查看>>
Python 学习小结
查看>>
Python 学习日记第三篇 -- 字典
查看>>
Python 学习笔记(一)Data type
查看>>
python 安装 easy_install 和 pip 流程
查看>>
python 安装echarts
查看>>
python 安装opencv及问题解决
查看>>
Python 安装程序:“写入文件 C:\Python27\pythonw.exe 时出错“
查看>>
Python 安装避坑指南:从入门到进阶
查看>>