| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- import { packages } from '@/config.json';
- import frontCover from './index.vue';
- const Index = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'info' */ './info.vue');
- const Intro = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'intro' */ './page/intro.vue');
- const Start = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'start' */ './page/start.vue');
- const International = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'international' */ './page/international.vue');
- const Theme = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'theme' */ './page/theme.vue');
- const JoinUs = () => import(/* webpackPrefetch: true */ /* webpackChunkName: 'joinus' */ './page/joinus.vue');
- //const Update = () => import('./page/changelog.vue');
- Vue.use(VueRouter);
- const routes = [
- {
- path: '*',
- redirect: '/index'
- },
- {
- path: '/',
- redirect: '/index'
- },
- {
- path: '/index',
- name: 'frontcover',
- component: frontCover
- },
- {
- path: '/intro',
- name: 'intr',
- components: {
- default: Index,
- main: Intro
- }
- },
- {
- path: '/international',
- name: 'international',
- components: {
- default: Index,
- main: International
- }
- },
- {
- path: '/start',
- name: 'start',
- components: {
- default: Index,
- main: Start
- }
- },
- {
- path: '/theme',
- name: 'theme',
- components: {
- default: Index,
- main: Theme
- }
- },
- {
- path: '/joinus',
- name: 'joinus',
- components: {
- default: Index,
- main: JoinUs
- }
- }
- ];
- //组件md文件展示
- packages.map(item => {
- if (item.showDemo === false) return;
- const pkgName = item.name.toLowerCase();
- routes.push({
- path: '/' + item.name,
- components: {
- default: Index,
- main: () => import('./view/' + pkgName + '.vue')
- },
- name: item.name
- });
- });
- const router = new VueRouter({
- routes,
- scrollBehavior(to, from, savedPosition) {
- if (to.path == '/index') {
- return null;
- } else {
- return { x: 0, y: 0 };
- }
- }
- });
- export default router;
|