index.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  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. // -----------fr---------
  379. // ----------liuj------------
  380. {
  381. path: '/goodList',
  382. component: Layout,
  383. children: [
  384. {
  385. name: '',
  386. path: '',
  387. component: () => import('@/views/news/GoodList'),
  388. meta: {
  389. title: '商品列表',
  390. hidden: true,
  391. breadcrumb: true
  392. }
  393. }
  394. ]
  395. },
  396. {
  397. path: '/addGood',
  398. component: Layout,
  399. children: [
  400. {
  401. name: '',
  402. path: '',
  403. component: () => import('@/views/news/addGood'),
  404. meta: {
  405. title: '添加商品',
  406. hidden: true,
  407. breadcrumb: true
  408. }
  409. }
  410. ]
  411. },
  412. // ----------liuj------------
  413. {
  414. path: '/topic',
  415. component: Layout,
  416. children: [
  417. {
  418. name: '',
  419. path: '',
  420. component: () => import('@/views/chat/topic'),
  421. meta: {
  422. title: '课题',
  423. hidden: true,
  424. breadcrumb: true
  425. }
  426. }
  427. ]
  428. },
  429. {
  430. path: '/webRule',
  431. component: Layout,
  432. children: [
  433. {
  434. name: '',
  435. path: '',
  436. component: () => import('@/views/crawler/webRule'),
  437. meta: {
  438. title: '规则列表',
  439. hidden: true,
  440. breadcrumb: true
  441. }
  442. }
  443. ]
  444. },
  445. {
  446. path: '/creatTopic',
  447. component: Layout,
  448. children: [
  449. {
  450. name: '',
  451. path: '',
  452. component: () => import('@/views/chat/creatTopic'),
  453. meta: {
  454. title: '编辑课题',
  455. hidden: true,
  456. breadcrumb: true
  457. }
  458. }
  459. ]
  460. },
  461. {
  462. path: '/webCrawlerList',
  463. component: Layout,
  464. children: [
  465. {
  466. name: '',
  467. path: '',
  468. component: () => import('@/views/crawler/webCrawlerList'),
  469. meta: {
  470. title: '采集列表',
  471. hidden: true,
  472. breadcrumb: true
  473. }
  474. }
  475. ]
  476. },
  477. {
  478. path: '/webCrawlerListEdit',
  479. component: Layout,
  480. children: [
  481. {
  482. name: '',
  483. path: '',
  484. component: () => import('@/views/crawler/webCrawlerListEdit'),
  485. meta: {
  486. title: '编辑资讯',
  487. hidden: true,
  488. breadcrumb: true
  489. }
  490. }
  491. ]
  492. },
  493. {
  494. path: '/adList',
  495. component: Layout,
  496. children: [
  497. {
  498. name: '',
  499. path: '',
  500. component: () => import('@/views/advertise/advertiseList.vue'),
  501. meta: {
  502. title: '广告列表',
  503. hidden: true,
  504. breadcrumb: true
  505. }
  506. }
  507. ]
  508. },
  509. {
  510. path: '/adPlaceList',
  511. component: Layout,
  512. children: [
  513. {
  514. name: '',
  515. path: '',
  516. component: () => import('@/views/advertise/adPlaceList'),
  517. meta: {
  518. title: '广告位管理',
  519. hidden: true,
  520. breadcrumb: true
  521. }
  522. }
  523. ]
  524. },
  525. {//站点标识
  526. path: '/websiteTag',
  527. component: Layout,
  528. children: [
  529. {
  530. name: '',
  531. path: '',
  532. component: () => import('@/views/website/websiteTag'),
  533. meta: {
  534. title: '网站分组',
  535. hidden: true,
  536. breadcrumb: true
  537. }
  538. }
  539. ]
  540. },
  541. {
  542. path: '/adPlaceDetail',
  543. component: Layout,
  544. children: [
  545. {
  546. name: '',
  547. path: '',
  548. component: () => import('@/views/advertise/adPlaceDetail'),
  549. meta: {
  550. title: '广告位详情',
  551. hidden: true,
  552. breadcrumb: true
  553. }
  554. }
  555. ]
  556. },
  557. {
  558. path: '/blogroll',
  559. component: Layout,
  560. children: [
  561. {
  562. name: '',
  563. path: '',
  564. component: () => import('@/views/website/blogroll.vue'),
  565. meta: {
  566. title: '友情链接',
  567. hidden: true,
  568. breadcrumb: true
  569. }
  570. }
  571. ]
  572. },
  573. {
  574. path: '/tabbar',
  575. component: Layout,
  576. children: [
  577. {
  578. name: '',
  579. path: '',
  580. component: () => import('@/views/tabbar/tabbar.vue'),
  581. meta: {
  582. title: '底部导航栏',
  583. hidden: true,
  584. breadcrumb: true
  585. }
  586. }
  587. ]
  588. },
  589. {
  590. path: '/tabbarDetail',
  591. component: Layout,
  592. children: [
  593. {
  594. name: '',
  595. path: '',
  596. component: () => import('@/views/tabbar/tabbarDetail.vue'),
  597. meta: {
  598. title: '导航详情',
  599. hidden: true,
  600. breadcrumb: true
  601. }
  602. }
  603. ]
  604. },
  605. // {
  606. // path: '/documentation',
  607. // component: Layout,
  608. // children: [
  609. // {
  610. // path: 'index',
  611. // component: () => import('@/views/documentation/index'),
  612. // name: 'Documentation',
  613. // meta: { title: 'documentation', icon: 'documentation', affix: true }
  614. // }
  615. // ]
  616. // },
  617. // {
  618. // path: '/guide',
  619. // component: Layout,
  620. // redirect: '/guide/index',
  621. // children: [
  622. // {
  623. // path: 'index',
  624. // component: () => import('@/views/guide/index'),
  625. // name: 'Guide',
  626. // meta: { title: 'guide', icon: 'guide', noCache: true }
  627. // }
  628. // ]
  629. // },
  630. {
  631. path: '/profile',
  632. component: Layout,
  633. redirect: '/profile/index',
  634. hidden: true,
  635. children: [
  636. {
  637. path: 'index',
  638. component: () => import('@/views/profile/index'),
  639. name: 'Profile',
  640. meta: {
  641. title: '个人中心',
  642. hidden: true,
  643. breadcrumb: true
  644. }
  645. }
  646. ]
  647. }
  648. ]
  649. /**
  650. * asyncRoutes
  651. * the routes that need to be dynamically loaded based on user roles
  652. */
  653. export const asyncRoutes = [
  654. {
  655. path: '/permission',
  656. component: Layout,
  657. redirect: '/permission/page',
  658. alwaysShow: true, // will always show the root menu
  659. name: 'Permission',
  660. meta: {
  661. title: 'permission',
  662. icon: 'lock',
  663. roles: ['admin', 'editor'] // you can set roles in root nav
  664. },
  665. children: [
  666. {
  667. path: 'page',
  668. component: () => import('@/views/permission/page'),
  669. name: 'PagePermission',
  670. meta: {
  671. title: 'pagePermission',
  672. roles: ['admin'] // or you can only set roles in sub nav
  673. }
  674. },
  675. {
  676. path: 'directive',
  677. component: () => import('@/views/permission/directive'),
  678. name: 'DirectivePermission',
  679. meta: {
  680. title: 'directivePermission'
  681. // if do not set roles, means: this page does not require permission
  682. }
  683. },
  684. {
  685. path: 'role',
  686. component: () => import('@/views/permission/role'),
  687. name: 'RolePermission',
  688. meta: {
  689. title: 'rolePermission',
  690. roles: ['admin']
  691. }
  692. }
  693. ]
  694. },
  695. {
  696. path: '/icon',
  697. component: Layout,
  698. children: [
  699. {
  700. path: 'index',
  701. component: () => import('@/views/icons/index'),
  702. name: 'Icons',
  703. meta: { title: 'icons', icon: 'icon', noCache: true }
  704. }
  705. ]
  706. },
  707. /** when your routing map is too long, you can split it into small modules **/
  708. componentsRouter,
  709. chartsRouter,
  710. nestedRouter,
  711. tableRouter,
  712. {
  713. path: '/example',
  714. component: Layout,
  715. redirect: '/example/list',
  716. name: 'Example',
  717. meta: {
  718. title: 'example',
  719. icon: 'el-icon-s-help'
  720. },
  721. children: [
  722. {
  723. path: 'create',
  724. component: () => import('@/views/example/create'),
  725. name: 'CreateArticle',
  726. meta: { title: 'createArticle', icon: 'edit' }
  727. },
  728. {
  729. path: 'edit/:id(\\d+)',
  730. component: () => import('@/views/example/edit'),
  731. name: 'EditArticle',
  732. meta: { title: 'editArticle', noCache: true, activeMenu: '/example/list' },
  733. hidden: true
  734. },
  735. {
  736. path: 'list',
  737. component: () => import('@/views/example/list'),
  738. name: 'ArticleList',
  739. meta: { title: 'articleList', icon: 'list' }
  740. }
  741. ]
  742. },
  743. {
  744. path: '/tab',
  745. component: Layout,
  746. children: [
  747. {
  748. path: 'index',
  749. component: () => import('@/views/tab/index'),
  750. name: 'Tab',
  751. meta: { title: 'tab', icon: 'tab' }
  752. }
  753. ]
  754. },
  755. {
  756. path: '/error',
  757. component: Layout,
  758. redirect: 'noRedirect',
  759. name: 'ErrorPages',
  760. meta: {
  761. title: 'errorPages',
  762. icon: '404'
  763. },
  764. children: [
  765. {
  766. path: '401',
  767. component: () => import('@/views/error-page/401'),
  768. name: 'Page401',
  769. meta: { title: 'page401', noCache: true }
  770. },
  771. {
  772. path: '404',
  773. component: () => import('@/views/error-page/404'),
  774. name: 'Page404',
  775. meta: { title: 'page404', noCache: true }
  776. }
  777. ]
  778. },
  779. {
  780. path: '/error-log',
  781. component: Layout,
  782. children: [
  783. {
  784. path: 'log',
  785. component: () => import('@/views/error-log/index'),
  786. name: 'ErrorLog',
  787. meta: { title: 'errorLog', icon: 'bug' }
  788. }
  789. ]
  790. },
  791. {
  792. path: '/excel',
  793. component: Layout,
  794. redirect: '/excel/export-excel',
  795. name: 'Excel',
  796. meta: {
  797. title: 'excel',
  798. icon: 'excel'
  799. },
  800. children: [
  801. {
  802. path: 'export-excel',
  803. component: () => import('@/views/excel/export-excel'),
  804. name: 'ExportExcel',
  805. meta: { title: 'exportExcel' }
  806. },
  807. {
  808. path: 'export-selected-excel',
  809. component: () => import('@/views/excel/select-excel'),
  810. name: 'SelectExcel',
  811. meta: { title: 'selectExcel' }
  812. },
  813. {
  814. path: 'export-merge-header',
  815. component: () => import('@/views/excel/merge-header'),
  816. name: 'MergeHeader',
  817. meta: { title: 'mergeHeader' }
  818. },
  819. {
  820. path: 'upload-excel',
  821. component: () => import('@/views/excel/upload-excel'),
  822. name: 'UploadExcel',
  823. meta: { title: 'uploadExcel' }
  824. }
  825. ]
  826. },
  827. {
  828. path: '/zip',
  829. component: Layout,
  830. redirect: '/zip/download',
  831. alwaysShow: true,
  832. name: 'Zip',
  833. meta: { title: 'zip', icon: 'zip' },
  834. children: [
  835. {
  836. path: 'download',
  837. component: () => import('@/views/zip/index'),
  838. name: 'ExportZip',
  839. meta: { title: 'exportZip' }
  840. }
  841. ]
  842. },
  843. {
  844. path: '/pdf',
  845. component: Layout,
  846. redirect: '/pdf/index',
  847. children: [
  848. {
  849. path: 'index',
  850. component: () => import('@/views/pdf/index'),
  851. name: 'PDF',
  852. meta: { title: 'pdf', icon: 'pdf' }
  853. }
  854. ]
  855. },
  856. {
  857. path: '/pdf/download',
  858. component: () => import('@/views/pdf/download'),
  859. hidden: true
  860. },
  861. {
  862. path: '/theme',
  863. component: Layout,
  864. children: [
  865. {
  866. path: 'index',
  867. component: () => import('@/views/theme/index'),
  868. name: 'Theme',
  869. meta: { title: 'theme', icon: 'theme' }
  870. }
  871. ]
  872. },
  873. {
  874. path: '/clipboard',
  875. component: Layout,
  876. children: [
  877. {
  878. path: 'index',
  879. component: () => import('@/views/clipboard/index'),
  880. name: 'ClipboardDemo',
  881. meta: { title: 'clipboardDemo', icon: 'clipboard' }
  882. }
  883. ]
  884. },
  885. {
  886. path: '/i18n',
  887. component: Layout,
  888. children: [
  889. {
  890. path: 'index',
  891. component: () => import('@/views/i18n-demo/index'),
  892. name: 'I18n',
  893. meta: { title: 'i18n', icon: 'international' }
  894. }
  895. ]
  896. },
  897. {
  898. path: 'external-link',
  899. component: Layout,
  900. children: [
  901. {
  902. path: 'https://github.com/PanJiaChen/vue-element-admin',
  903. meta: { title: 'externalLink', icon: 'link' }
  904. }
  905. ]
  906. },
  907. // 404 page must be placed at the end !!!
  908. { path: '*', redirect: '/404', hidden: true }
  909. ]
  910. const createRouter = () => new Router({
  911. // mode: 'history', // require service support
  912. scrollBehavior: () => ({ y: 0 }),
  913. routes: constantRoutes
  914. })
  915. const router = createRouter()
  916. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  917. export function resetRouter() {
  918. const newRouter = createRouter()
  919. router.matcher = newRouter.matcher // reset router
  920. }
  921. export default router