| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import Vue from 'vue'
- import Router from 'vue-router'
- import LevelRouter from './levelRouter'
- import ApplyRouter from './applyRouter'
- import AdapayRouter from './adapayRouter'
- Vue.use(Router)
- let defaultRouter = [
- {
- path: '/',
- redirect: {
- name: 'signUp'
- }
- }, {
- path: "/levelMusic",
- name: "levelMusic",
- component: () =>
- import( /* webpackChunkName: "LevelMusic" */ "@/views/LevelMusic"),
- meta: {
- description: "音乐考级",
- weight: 1 // 页面权重
- }
- }, {
- path: "/paymentResult",
- name: "paymentResult",
- component: () =>
- import( /* webpackChunkName: "PaymentResult" */ "@/views/PaymentResult"),
- meta: {
- description: "支付结果",
- weight: 2 // 页面权重
- }
- }
- ]
- defaultRouter = defaultRouter.concat(LevelRouter)
- .concat(ApplyRouter)
- .concat(AdapayRouter)
- const router = new Router({
- // mode: 'history',
- // base: process.env.BASE_URL,
- routes: defaultRouter,
- scrollBehavior () {
- return { x: 0, y: 0 }
- }
- })
- router.onError((error) => {
- const pattern = /Loading chunk (\d)+ failed/g;
- const isChunkLoadFailed = error.message.match(pattern);
- const targetPath = router.history.pending.fullPath;
- if (isChunkLoadFailed) {
- router.replace(targetPath);
- }
- })
- export default router
|