| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import Vue from 'vue'
- import Router from 'vue-router'
- import { interopDefault } from './utils'
- const _017ba64e = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
- const _3599ba51 = () => interopDefault(import('../pages/index/index.vue' /* webpackChunkName: "pages/index/index" */))
- const _dfb55690 = () => interopDefault(import('../pages/index/cert/index.vue' /* webpackChunkName: "pages/index/cert/index" */))
- const _6952764e = () => interopDefault(import('../pages/index/type/index.vue' /* webpackChunkName: "pages/index/type/index" */))
- const _dcf8ade6 = () => interopDefault(import('../pages/index/cert/freelancer.vue' /* webpackChunkName: "pages/index/cert/freelancer" */))
- const _bc074ab6 = () => interopDefault(import('../pages/index/cert/id.vue' /* webpackChunkName: "pages/index/cert/id" */))
- const _ca5e67b8 = () => interopDefault(import('../pages/index/type/pay.vue' /* webpackChunkName: "pages/index/type/pay" */))
- const _3543bdce = () => interopDefault(import('../pages/index/type/vip.vue' /* webpackChunkName: "pages/index/type/vip" */))
- const _8c50bd16 = () => interopDefault(import('../pages/index/vip/pay.vue' /* webpackChunkName: "pages/index/vip/pay" */))
- Vue.use(Router)
- if (process.client) {
- window.history.scrollRestoration = 'manual'
- }
- const scrollBehavior = function (to, from, savedPosition) {
- // if the returned position is falsy or an empty object,
- // will retain current scroll position.
- let position = false
- // if no children detected
- if (to.matched.length < 2) {
- // scroll to the top of the page
- position = { x: 0, y: 0 }
- } else if (to.matched.some(r => r.components.default.options.scrollToTop)) {
- // if one of the children has scrollToTop option set to true
- position = { x: 0, y: 0 }
- }
- // savedPosition is only available for popstate navigations (back button)
- if (savedPosition) {
- position = savedPosition
- }
- return new Promise((resolve) => {
- // wait for the out transition to complete (if necessary)
- window.$nuxt.$once('triggerScroll', () => {
- // coords will be used if no selector is provided,
- // or if the selector didn't match any element.
- if (to.hash) {
- let hash = to.hash
- // CSS.escape() is not supported with IE and Edge.
- if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
- hash = '#' + window.CSS.escape(hash.substr(1))
- }
- try {
- if (document.querySelector(hash)) {
- // scroll to anchor by returning the selector
- position = { selector: hash }
- }
- } catch (e) {
- console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).')
- }
- }
- resolve(position)
- })
- })
- }
- export function createRouter() {
- return new Router({
- mode: 'history',
- base: '/',
- linkActiveClass: 'nuxt-link-active',
- linkExactActiveClass: 'nuxt-link-exact-active',
- scrollBehavior,
- routes: [{
- path: "/",
- component: _017ba64e,
- children: [{
- path: "",
- component: _3599ba51,
- name: "index"
- }, {
- path: "cert",
- component: _dfb55690,
- name: "index-cert"
- }, {
- path: "type",
- component: _6952764e,
- name: "index-type"
- }, {
- path: "cert/freelancer",
- component: _dcf8ade6,
- name: "index-cert-freelancer"
- }, {
- path: "cert/id",
- component: _bc074ab6,
- name: "index-cert-id"
- }, {
- path: "type/pay",
- component: _ca5e67b8,
- name: "index-type-pay"
- }, {
- path: "type/vip",
- component: _3543bdce,
- name: "index-type-vip"
- }, {
- path: "vip/pay",
- component: _8c50bd16,
- name: "index-vip-pay"
- }]
- }],
- fallback: false
- })
- }
|