为了账号安全,请及时绑定邮箱和手机立即绑定

vue没有重复路由,为什么报这个警告,如下图

vue没有重复路由,为什么报这个警告,如下图

PHP
神不在的星期二 2019-03-03 14:35:11
import Vue from 'vue' import Router from 'vue-router' import Index from '../views/index/index' import Index_index from '../views/index/index_index' // 授课 import Teaching from '../views/teaching/teaching' import Class from '../views/teaching/class' import Information from '../views/teaching/information' // 教务 import TeachingAffair from '../views/teachingAffair/teachingAffair' import ClassCreate from '../views/teachingAffair/classCreate' import CourseArrange from '../views/teachingAffair/courseArrange' import ExamCreate from '../views/teachingAffair/examCreate' import Campus from '../views/teachingAffair/campus' import TeachingAffairClass from '../views/teachingAffair/class' // 教研 import TeachingResearch from '../views/teachingResearch/teachingResearch' import Lecture from '../views/teachingResearch/lecture/lecture' import LectureCreate from '../views/teachingResearch/lecture/lectureCreate' import LectureEdit from '../views/teachingResearch/lecture/lectureEdit' import Paper from '../views/teachingResearch/paper/paper' import PaperCreate from '../views/teachingResearch/paper/paperCreate' import PaperLeadIn from '../views/teachingResearch/paper/paperLeadIn' import Question from '../views/teachingResearch/question/question' import QuestionCreate from '../views/teachingResearch/question/questionCreate' import QuestionEdit from '../views/teachingResearch/question/questionEdit' // 用户 import User from '../views/user/user' import Role from '../views/user/role/role' import Student from '../views/user/student/student' import Teacher from '../views/user/teacher/teacher' // 测试 import Test from '../views/test/test' import Test1 from '../views/test/test1' import Test2 from '../views/test/test2' import Test3 from '../views/test/test3' import Test4 from '../views/test/test4' import Test5 from '../views/test/test5' import Test4children from '../views/test/test4children' Vue.use(Router) export default new Router({ routes: [ { path: '/', name: 'Index', component: Index, redirect: '/index', children: [ { path: '/index', name: 'Index_index', component: Index_index }, // 授课 { path: '/teaching', name: 'Teaching', component: Teaching, redirect: '/teaching/class', children: [ { path: '/teaching/class', name: 'Class', component: Class, }, { path: '/teaching/information', name: 'Information', component: Information, } ] }, // 教务 { path: '/teachingAffair', redirect: '/teachingAffair/campus' // name: 'TeachingAffair', // component: TeachingAffair }, { path: '/teachingAffair/classCreate', component: TeachingAffair, children:[ { path:'/teachingAffair/classCreate', name:'ClassCreate', component:ClassCreate }, { path:'/teachingAffair/courseArrange', name:'CourseArrange', component:CourseArrange }, { path:'/teachingAffair/examCreate', name:'ExamCreate', component:ExamCreate }, { path:'/teachingAffair/campus', name:'Campus', component:Campus }, { path:'/teachingAffair/class', name:'TeachingAffairClass', component:TeachingAffairClass } ] }, // 教研 { path: '/teachingResearch', redirect: '/teachingResearch/lecture' }, { path: '/teachingResearch/lecture', component: TeachingResearch, children: [ { path: '/teachingResearch/lecture', name: 'Lecture', component: Lecture }, { path: '/teachingResearch/lectureCreate', name: 'LectureCreate', component: LectureCreate, }, { path: '/teachingResearch/LectureEdit', name: 'LectureEdit', component: LectureEdit }, { path: '/teachingResearch/paper', name: Paper, component: Paper }, { path: '/teachingResearch/paperCreate', name: PaperCreate, component: PaperCreate }, { path: '/teachingResearch/paperLeadIn', name: PaperLeadIn, component: PaperLeadIn }, { path: '/teachingResearch/question', name: Question, component: Question, // children:[ // { // path: '/teachingResearch/question/questionEdit', // name: QuestionEdit, // component: QuestionEdit, // } // ] }, { path: '/teachingResearch/questionCreate', name: QuestionCreate, component: QuestionCreate }, { path: '/teachingResearch/questionEdit', name: QuestionEdit, component: QuestionEdit, } ] }, // 用户 { path: '/user', name: 'User', component: User, redirect: '/user/teacher', children: [ { path: '/user/role', name: Role, component: Role }, { path: '/user/student', name: Student, component: Student }, { path: '/user/teacher', name: Teacher, component: Teacher } ] } ] }, // 测试 { path: '/test', name: 'Test', component: Test, children: [ { path: 'test1', name: 'Test1', component: Test1, }, { path: 'test2', name: 'Test2', component: Test2, }, { path: 'test3', name: 'Test3', component: Test3, }, { path: 'test4', name: 'Test4', component: Test4, }, { path: 'test4children', name: 'Test4children', component: Test4children, } ,{ path: 'test5', name: 'Test5', component: Test5, }, ] } ] })
查看完整描述

2 回答

?
鸿蒙传说

TA贡献1865条经验 获得超7个赞

请注意从 '/teachingResearch/paper' 开始,后面的路由对象 name 都漏了引号。

查看完整回答
反对 回复 2019-03-18
?
ABOUTYOU

TA贡献1812条经验 获得超5个赞

name 命名有问题。变量Role是什么?

查看完整回答
反对 回复 2019-03-18
  • 2 回答
  • 0 关注
  • 552 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信