详解Vue.js项目API、Router配置拆分实践(2)

/** * 教学排课 * 教研 * Created by Bing on 2017/6/19 0019. */ import courseIndex from 'components/studyCourse/index/index'; import waitCourse from 'components/studyCourse/waitCourse/waitCourse'; import alreadyCourse from 'components/studyCourse/alreadyCourse/alreadyCourse'; import gearCourse from 'components/studyCourse/waitCourse/gearCourse'; import courseWare from 'components/teachingResearch/courseware/courseware.vue'; import courseWareLibrary from 'components/teachingResearch/courseware/library.vue'; export default function(router) { router.map({ '/study/index': {component: courseIndex}, '/study/waitCourse': {component: waitCourse},//待排课程 '/study/waitCourse/gearCourse': {component: gearCourse},//待排 '/study/course': {component: alreadyCourse},//已排课程 '/tr/courseware': {component: courseWare},//课件管理 '/tr/courseWare/library': {component: courseWareLibrary},//自主上传课件库 }); }

拆分后,每个模块管理它自己领域的router、api,router.config.js和api.config.js就大大瘦身了,也降低了命名冲突的问题和将来混乱的问题。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/pxxds.html