import Vue from 'vue'
import Router from 'vue-router'
import allConstRoutes from './allConstRoutes'
export const constantRoutes = allConstRoutes

Vue.use(Router)

export const asyncRoutes = [ // 异步加载路由
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  // base: '/adminVueElement/',
  routes: constantRoutes,
  // mode: 'history'
  mode: 'hash'
})

const router = createRouter()

export function resetRouter() { // 重置路由
  router.matcher = createRouter().matcher
}

export default router
