index.js 21 KB

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