index.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /* Router Modules */
  7. import componentsRouter from './modules/components'
  8. import chartsRouter from './modules/charts'
  9. import tableRouter from './modules/table'
  10. import nestedRouter from './modules/nested'
  11. /**
  12. * Note: sub-menu only appear when route children.length >= 1
  13. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  14. *
  15. * hidden: true if set true, item will not show in the sidebar(default is false)
  16. * alwaysShow: true if set true, will always show the root menu
  17. * if not set alwaysShow, when item has more than one children route,
  18. * it will becomes nested mode, otherwise not show the root menu
  19. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  20. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  21. * meta : {
  22. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  23. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  24. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  25. noCache: true if set true, the page will no be cached(default is false)
  26. affix: true if set true, the tag will affix in the tags-view
  27. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  28. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  29. }
  30. */
  31. /**
  32. * constantRoutes
  33. * a base page that does not have permission requirements
  34. * all roles can be accessed
  35. */
  36. export const constantRoutes = [
  37. {
  38. path: '/redirect',
  39. component: Layout,
  40. hidden: true,
  41. children: [
  42. {
  43. path: '/redirect/:path(.*)',
  44. component: () => import('@/views/redirect/index')
  45. }
  46. ]
  47. },
  48. {
  49. path: '/login',
  50. component: () => import('@/views/login/index'),
  51. hidden: true
  52. },
  53. {
  54. path: '/auth-redirect',
  55. component: () => import('@/views/login/auth-redirect'),
  56. hidden: true
  57. },
  58. {
  59. path: '/404',
  60. component: () => import('@/views/error-page/404'),
  61. hidden: true
  62. },
  63. {
  64. path: '/401',
  65. component: () => import('@/views/error-page/401'),
  66. hidden: true
  67. },
  68. {
  69. path: '/',
  70. component: Layout,
  71. redirect: '/dashboard', //访问/的时候会跳转到dashboard
  72. children: [
  73. {
  74. path: 'dashboard',
  75. component: () => import('@/views/dashboard/index'),
  76. name: '首页',
  77. meta: {
  78. title: '首页',
  79. icon: require('@/assets/public/sidebar/default/index.png'),
  80. selected_icon: require('@/assets/public/sidebar/select/index.png'),
  81. affix: true,
  82. }
  83. }
  84. ]
  85. },
  86. //增加新的路由 站点列表
  87. //注意必须含有component:Layout项目否则会导致页面找不到模板
  88. //必须含有children中的path且两个path必须一致
  89. {
  90. path: '/website',
  91. component: Layout,
  92. children: [
  93. {
  94. name: '', //直接就是根目录所以为空
  95. path: '',
  96. component: () => import('@/views/website/WebsiteList'),
  97. meta: {
  98. title: '网站管理', // 设置菜单和面包屑显示的标题
  99. hidden: true, // 不在侧边菜单显示
  100. breadcrumb: true // 强制在面包屑中显示
  101. }
  102. }
  103. ]
  104. },
  105. {
  106. path: '/categoryList',
  107. component: Layout,
  108. children: [
  109. {
  110. name: '',
  111. path: '',
  112. component: () => import('@/views/website/categoryList'),
  113. meta: {
  114. title: '栏目名称',
  115. hidden: true,
  116. breadcrumb: true
  117. }
  118. }
  119. ]
  120. },
  121. {
  122. path: '/websiteColumn',
  123. component: Layout,
  124. children: [
  125. {
  126. name: '',
  127. path: '',
  128. component: () => import('@/views/website/websiteColumn'),
  129. meta: {
  130. title: '栏目分配',
  131. hidden: true,
  132. breadcrumb: true
  133. }
  134. }
  135. ]
  136. },
  137. {
  138. path: '/editNavigation',
  139. component: Layout,
  140. children: [
  141. {
  142. name: '',
  143. path: '',
  144. component: () => import('@/views/website/editNavigation'),
  145. meta: {
  146. title: '栏目详情',
  147. hidden: true,
  148. breadcrumb: true
  149. }
  150. }
  151. ]
  152. },
  153. {
  154. path: '/articleList',
  155. component: Layout,
  156. children: [
  157. {
  158. name: '',
  159. path: '',
  160. component: () => import('@/views/news/NewList'),
  161. meta: {
  162. title: '资讯列表',
  163. hidden: true,
  164. breadcrumb: true
  165. }
  166. }
  167. ]
  168. },
  169. {
  170. path: '/examine',
  171. component: Layout,
  172. children: [
  173. {
  174. name: '',
  175. path: '',
  176. component: () => import('@/views/news/examine'),
  177. meta: {
  178. title: '待审核列表',
  179. hidden: true,
  180. breadcrumb: true
  181. }
  182. }
  183. ]
  184. },
  185. {
  186. path: '/creatNews',
  187. component: Layout,
  188. children: [
  189. {
  190. name: '',
  191. path: '',
  192. component: () => import('@/views/news/creatNews'),
  193. meta: {
  194. title: '添加资讯',
  195. hidden: true,
  196. breadcrumb: true
  197. }
  198. }
  199. ]
  200. },
  201. {
  202. path: '/menuList',
  203. component: Layout,
  204. children: [
  205. {
  206. name: '',
  207. path: '',
  208. component: () => import('@/views/menu/menulist'),
  209. meta: {
  210. title: '菜单列表',
  211. hidden: true,
  212. breadcrumb: true
  213. }
  214. }
  215. ]
  216. },
  217. {
  218. path: '/complaintList',
  219. component: Layout,
  220. children: [
  221. {
  222. name: '',
  223. path: '',
  224. component: () => import('@/views/complaint/complaintList'),
  225. meta: {
  226. title: '投诉举报',
  227. hidden: true,
  228. breadcrumb: true
  229. }
  230. }
  231. ]
  232. },
  233. {
  234. path: '/roleList',
  235. component: Layout,
  236. children: [
  237. {
  238. name: '',
  239. path: '',
  240. component: () => import('@/views/role/roleList'),
  241. meta: {
  242. title: '角色管理',
  243. hidden: true,
  244. breadcrumb: true
  245. }
  246. }
  247. ]
  248. },
  249. {
  250. path: '/userList',
  251. component: Layout,
  252. children: [
  253. {
  254. name: '',
  255. path: '',
  256. component: () => import('@/views/role/userList'),
  257. meta: {
  258. title: '用户管理',
  259. hidden: true,
  260. breadcrumb: true
  261. }
  262. }
  263. ]
  264. },
  265. {
  266. path: '/creatUser',
  267. component: Layout,
  268. children: [
  269. {
  270. name: '',
  271. path: '',
  272. component: () => import('@/views/role/creatUser'),
  273. meta: {
  274. title: '添加用户',
  275. hidden: true,
  276. breadcrumb: true
  277. }
  278. }
  279. ]
  280. },
  281. {
  282. path: '/department',
  283. component: Layout,
  284. children: [
  285. {
  286. name: '',
  287. path: '',
  288. component: () => import('@/views/menu/department'),
  289. meta: {
  290. title: '行政职能',
  291. hidden: true,
  292. breadcrumb: true
  293. }
  294. }
  295. ]
  296. },
  297. {
  298. path: '/hall',
  299. component: Layout,
  300. children: [
  301. {
  302. name: '',
  303. path: '',
  304. component: () => import('@/views/chat/hall'),
  305. meta: {
  306. title: '聊天',
  307. hidden: true,
  308. breadcrumb: true
  309. }
  310. }
  311. ]
  312. },
  313. {
  314. path: '/creatWebsite',
  315. component: Layout,
  316. children: [
  317. {
  318. name: '',
  319. path: '',
  320. component: () => import('@/views/website/creatWebsite'),
  321. meta: {
  322. title: '搭建网站',
  323. hidden: true,
  324. breadcrumb: true
  325. }
  326. }
  327. ]
  328. },
  329. {
  330. path: '/contacts',
  331. component: Layout,
  332. children: [
  333. {
  334. name: '',
  335. path: '',
  336. component: () => import('@/views/chat/contacts'),
  337. meta: {
  338. title: '通讯录',
  339. hidden: true,
  340. breadcrumb: true
  341. }
  342. }
  343. ]
  344. },
  345. {
  346. path: '/webCrawler',
  347. component: Layout,
  348. children: [
  349. {
  350. name: '',
  351. path: '',
  352. component: () => import('@/views/crawler/webCrawler'),
  353. meta: {
  354. title: '建立网站',
  355. hidden: true,
  356. breadcrumb: true
  357. }
  358. }
  359. ]
  360. },
  361. // ----fr-课题分类
  362. {
  363. path: '/topicType',
  364. component: Layout,
  365. children: [
  366. {
  367. name: '',
  368. path: '',
  369. component: () => import('@/views/chat/topicType'),
  370. meta: {
  371. title: '课题分类',
  372. hidden: true,
  373. breadcrumb: true
  374. }
  375. }
  376. ]
  377. },
  378. {
  379. path: '/surveyList',
  380. component: Layout,
  381. children: [
  382. {
  383. name: '',
  384. path: '',
  385. component: () => import('@/views/news/surveyList'),
  386. meta: {
  387. title: '投票列表',
  388. hidden: true,
  389. breadcrumb: true
  390. }
  391. }
  392. ]
  393. },
  394. // -----------fr---------
  395. // ----------liuj------------
  396. {
  397. path: '/goodList',
  398. component: Layout,
  399. children: [
  400. {
  401. name: '',
  402. path: '',
  403. component: () => import('@/views/news/GoodList'),
  404. meta: {
  405. title: '商品列表',
  406. hidden: true,
  407. breadcrumb: true
  408. }
  409. }
  410. ]
  411. },
  412. {
  413. path: '/addGood',
  414. component: Layout,
  415. children: [
  416. {
  417. name: '',
  418. path: '',
  419. component: () => import('@/views/news/addGood'),
  420. meta: {
  421. title: '添加商品',
  422. hidden: true,
  423. breadcrumb: true
  424. }
  425. }
  426. ]
  427. },
  428. // ----------liuj------------
  429. {
  430. path: '/topic',
  431. component: Layout,
  432. children: [
  433. {
  434. name: '',
  435. path: '',
  436. component: () => import('@/views/chat/topic'),
  437. meta: {
  438. title: '课题',
  439. hidden: true,
  440. breadcrumb: true
  441. }
  442. }
  443. ]
  444. },
  445. {
  446. path: '/webRule',
  447. component: Layout,
  448. children: [
  449. {
  450. name: '',
  451. path: '',
  452. component: () => import('@/views/crawler/webRule'),
  453. meta: {
  454. title: '规则列表',
  455. hidden: true,
  456. breadcrumb: true
  457. }
  458. }
  459. ]
  460. },
  461. {
  462. path: '/creatTopic',
  463. component: Layout,
  464. children: [
  465. {
  466. name: '',
  467. path: '',
  468. component: () => import('@/views/chat/creatTopic'),
  469. meta: {
  470. title: '编辑课题',
  471. hidden: true,
  472. breadcrumb: true
  473. }
  474. }
  475. ]
  476. },
  477. {
  478. path: '/webCrawlerList',
  479. component: Layout,
  480. children: [
  481. {
  482. name: '',
  483. path: '',
  484. component: () => import('@/views/crawler/webCrawlerList'),
  485. meta: {
  486. title: '采集列表',
  487. hidden: true,
  488. breadcrumb: true
  489. }
  490. }
  491. ]
  492. },
  493. {
  494. path: '/webCrawlerListEdit',
  495. component: Layout,
  496. children: [
  497. {
  498. name: '',
  499. path: '',
  500. component: () => import('@/views/crawler/webCrawlerListEdit'),
  501. meta: {
  502. title: '编辑资讯',
  503. hidden: true,
  504. breadcrumb: true
  505. }
  506. }
  507. ]
  508. },
  509. {
  510. path: '/adList',
  511. component: Layout,
  512. children: [
  513. {
  514. name: '',
  515. path: '',
  516. component: () => import('@/views/advertise/advertiseList.vue'),
  517. meta: {
  518. title: '广告列表',
  519. hidden: true,
  520. breadcrumb: true
  521. }
  522. }
  523. ]
  524. },
  525. {
  526. path: '/adPlaceList',
  527. component: Layout,
  528. children: [
  529. {
  530. name: '',
  531. path: '',
  532. component: () => import('@/views/advertise/adPlaceList'),
  533. meta: {
  534. title: '广告位管理',
  535. hidden: true,
  536. breadcrumb: true
  537. }
  538. }
  539. ]
  540. },
  541. {//站点标识
  542. path: '/websiteTag',
  543. component: Layout,
  544. children: [
  545. {
  546. name: '',
  547. path: '',
  548. component: () => import('@/views/website/websiteTag'),
  549. meta: {
  550. title: '网站分组',
  551. hidden: true,
  552. breadcrumb: true
  553. }
  554. }
  555. ]
  556. },
  557. {
  558. path: '/adPlaceDetail',
  559. component: Layout,
  560. children: [
  561. {
  562. name: '',
  563. path: '',
  564. component: () => import('@/views/advertise/adPlaceDetail'),
  565. meta: {
  566. title: '广告位详情',
  567. hidden: true,
  568. breadcrumb: true
  569. }
  570. }
  571. ]
  572. },
  573. {
  574. path: '/blogroll',
  575. component: Layout,
  576. children: [
  577. {
  578. name: '',
  579. path: '',
  580. component: () => import('@/views/website/blogroll.vue'),
  581. meta: {
  582. title: '友情链接',
  583. hidden: true,
  584. breadcrumb: true
  585. }
  586. }
  587. ]
  588. },
  589. {
  590. path: '/tabbar',
  591. component: Layout,
  592. children: [
  593. {
  594. name: '',
  595. path: '',
  596. component: () => import('@/views/tabbar/tabbar.vue'),
  597. meta: {
  598. title: '底部导航栏',
  599. hidden: true,
  600. breadcrumb: true
  601. }
  602. }
  603. ]
  604. },
  605. {
  606. path: '/tabbarDetail',
  607. component: Layout,
  608. children: [
  609. {
  610. name: '',
  611. path: '',
  612. component: () => import('@/views/tabbar/tabbarDetail.vue'),
  613. meta: {
  614. title: '导航详情',
  615. hidden: true,
  616. breadcrumb: true
  617. }
  618. }
  619. ]
  620. },
  621. // {
  622. // path: '/documentation',
  623. // component: Layout,
  624. // children: [
  625. // {
  626. // path: 'index',
  627. // component: () => import('@/views/documentation/index'),
  628. // name: 'Documentation',
  629. // meta: { title: 'documentation', icon: 'documentation', affix: true }
  630. // }
  631. // ]
  632. // },
  633. // {
  634. // path: '/guide',
  635. // component: Layout,
  636. // redirect: '/guide/index',
  637. // children: [
  638. // {
  639. // path: 'index',
  640. // component: () => import('@/views/guide/index'),
  641. // name: 'Guide',
  642. // meta: { title: 'guide', icon: 'guide', noCache: true }
  643. // }
  644. // ]
  645. // },
  646. {
  647. path: '/profile',
  648. component: Layout,
  649. redirect: '/profile/index',
  650. hidden: true,
  651. children: [
  652. {
  653. path: 'index',
  654. component: () => import('@/views/profile/index'),
  655. name: 'Profile',
  656. meta: {
  657. title: '个人中心',
  658. hidden: true,
  659. breadcrumb: true
  660. }
  661. }
  662. ]
  663. }
  664. ]
  665. /**
  666. * asyncRoutes
  667. * the routes that need to be dynamically loaded based on user roles
  668. */
  669. export const asyncRoutes = [
  670. {
  671. path: '/permission',
  672. component: Layout,
  673. redirect: '/permission/page',
  674. alwaysShow: true, // will always show the root menu
  675. name: 'Permission',
  676. meta: {
  677. title: 'permission',
  678. icon: 'lock',
  679. roles: ['admin', 'editor'] // you can set roles in root nav
  680. },
  681. children: [
  682. {
  683. path: 'page',
  684. component: () => import('@/views/permission/page'),
  685. name: 'PagePermission',
  686. meta: {
  687. title: 'pagePermission',
  688. roles: ['admin'] // or you can only set roles in sub nav
  689. }
  690. },
  691. {
  692. path: 'directive',
  693. component: () => import('@/views/permission/directive'),
  694. name: 'DirectivePermission',
  695. meta: {
  696. title: 'directivePermission'
  697. // if do not set roles, means: this page does not require permission
  698. }
  699. },
  700. {
  701. path: 'role',
  702. component: () => import('@/views/permission/role'),
  703. name: 'RolePermission',
  704. meta: {
  705. title: 'rolePermission',
  706. roles: ['admin']
  707. }
  708. }
  709. ]
  710. },
  711. {
  712. path: '/icon',
  713. component: Layout,
  714. children: [
  715. {
  716. path: 'index',
  717. component: () => import('@/views/icons/index'),
  718. name: 'Icons',
  719. meta: { title: 'icons', icon: 'icon', noCache: true }
  720. }
  721. ]
  722. },
  723. /** when your routing map is too long, you can split it into small modules **/
  724. componentsRouter,
  725. chartsRouter,
  726. nestedRouter,
  727. tableRouter,
  728. {
  729. path: '/example',
  730. component: Layout,
  731. redirect: '/example/list',
  732. name: 'Example',
  733. meta: {
  734. title: 'example',
  735. icon: 'el-icon-s-help'
  736. },
  737. children: [
  738. {
  739. path: 'create',
  740. component: () => import('@/views/example/create'),
  741. name: 'CreateArticle',
  742. meta: { title: 'createArticle', icon: 'edit' }
  743. },
  744. {
  745. path: 'edit/:id(\\d+)',
  746. component: () => import('@/views/example/edit'),
  747. name: 'EditArticle',
  748. meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' },
  749. hidden: true
  750. },
  751. {
  752. path: 'list',
  753. component: () => import('@/views/example/list'),
  754. name: 'ArticleList',
  755. meta: { title: 'articleList', icon: 'list' }
  756. }
  757. ]
  758. },
  759. {
  760. path: '/tab',
  761. component: Layout,
  762. children: [
  763. {
  764. path: 'index',
  765. component: () => import('@/views/tab/index'),
  766. name: 'Tab',
  767. meta: { title: 'tab', icon: 'tab' }
  768. }
  769. ]
  770. },
  771. {
  772. path: '/error',
  773. component: Layout,
  774. redirect: 'noRedirect',
  775. name: 'ErrorPages',
  776. meta: {
  777. title: 'errorPages',
  778. icon: '404'
  779. },
  780. children: [
  781. {
  782. path: '401',
  783. component: () => import('@/views/error-page/401'),
  784. name: 'Page401',
  785. meta: { title: 'page401', noCache: true }
  786. },
  787. {
  788. path: '404',
  789. component: () => import('@/views/error-page/404'),
  790. name: 'Page404',
  791. meta: { title: 'page404', noCache: true }
  792. }
  793. ]
  794. },
  795. {
  796. path: '/error-log',
  797. component: Layout,
  798. children: [
  799. {
  800. path: 'log',
  801. component: () => import('@/views/error-log/index'),
  802. name: 'ErrorLog',
  803. meta: { title: 'errorLog', icon: 'bug' }
  804. }
  805. ]
  806. },
  807. {
  808. path: '/excel',
  809. component: Layout,
  810. redirect: '/excel/export-excel',
  811. name: 'Excel',
  812. meta: {
  813. title: 'excel',
  814. icon: 'excel'
  815. },
  816. children: [
  817. {
  818. path: 'export-excel',
  819. component: () => import('@/views/excel/export-excel'),
  820. name: 'ExportExcel',
  821. meta: { title: 'exportExcel' }
  822. },
  823. {
  824. path: 'export-selected-excel',
  825. component: () => import('@/views/excel/select-excel'),
  826. name: 'SelectExcel',
  827. meta: { title: 'selectExcel' }
  828. },
  829. {
  830. path: 'export-merge-header',
  831. component: () => import('@/views/excel/merge-header'),
  832. name: 'MergeHeader',
  833. meta: { title: 'mergeHeader' }
  834. },
  835. {
  836. path: 'upload-excel',
  837. component: () => import('@/views/excel/upload-excel'),
  838. name: 'UploadExcel',
  839. meta: { title: 'uploadExcel' }
  840. }
  841. ]
  842. },
  843. {
  844. path: '/zip',
  845. component: Layout,
  846. redirect: '/zip/download',
  847. alwaysShow: true,
  848. name: 'Zip',
  849. meta: { title: 'zip', icon: 'zip' },
  850. children: [
  851. {
  852. path: 'download',
  853. component: () => import('@/views/zip/index'),
  854. name: 'ExportZip',
  855. meta: { title: 'exportZip' }
  856. }
  857. ]
  858. },
  859. {
  860. path: '/pdf',
  861. component: Layout,
  862. redirect: '/pdf/index',
  863. children: [
  864. {
  865. path: 'index',
  866. component: () => import('@/views/pdf/index'),
  867. name: 'PDF',
  868. meta: { title: 'pdf', icon: 'pdf' }
  869. }
  870. ]
  871. },
  872. {
  873. path: '/pdf/download',
  874. component: () => import('@/views/pdf/download'),
  875. hidden: true
  876. },
  877. {
  878. path: '/theme',
  879. component: Layout,
  880. children: [
  881. {
  882. path: 'index',
  883. component: () => import('@/views/theme/index'),
  884. name: 'Theme',
  885. meta: { title: 'theme', icon: 'theme' }
  886. }
  887. ]
  888. },
  889. {
  890. path: '/clipboard',
  891. component: Layout,
  892. children: [
  893. {
  894. path: 'index',
  895. component: () => import('@/views/clipboard/index'),
  896. name: 'ClipboardDemo',
  897. meta: { title: 'clipboardDemo', icon: 'clipboard' }
  898. }
  899. ]
  900. },
  901. {
  902. path: '/i18n',
  903. component: Layout,
  904. children: [
  905. {
  906. path: 'index',
  907. component: () => import('@/views/i18n-demo/index'),
  908. name: 'I18n',
  909. meta: { title: 'i18n', icon: 'international' }
  910. }
  911. ]
  912. },
  913. {
  914. path: 'external-link',
  915. component: Layout,
  916. children: [
  917. {
  918. path: 'https://github.com/PanJiaChen/vue-element-admin',
  919. meta: { title: 'externalLink', icon: 'link' }
  920. }
  921. ]
  922. },
  923. // 404 page must be placed at the end !!!
  924. { path: '*', redirect: '/404', hidden: true }
  925. ]
  926. const createRouter = () => new Router({
  927. // mode: 'history', // require service support
  928. scrollBehavior: () => ({ y: 0 }),
  929. routes: constantRoutes
  930. })
  931. const router = createRouter()
  932. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  933. export function resetRouter() {
  934. const newRouter = createRouter()
  935. router.matcher = newRouter.matcher // reset router
  936. }
  937. export default router