import Vue from 'vue'
import Router from 'vue-router'
import { routers } from './modules/router'
import { MyLocalStorage } from 'assets/js/utils'
import { SLIDER_FLAG, LOGIN_FLAG } from 'assets/js/storageConst'

console.log(SLIDER_FLAG)

Vue.use(Router)

const router = new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) { //如果savedPosition存在，滚动条会自动跳到记录的值的地方
      return savedPosition
    } else {
      return {x: 0, y: 0}//savedPosition也是一个记录x轴和y轴位置的对象
    }
  },
  routes: routers
})
export default router
export const routes = routers
