import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 静态路由
const constantRoutes = [
  { path: '/login', component: () => import('@/views/login/index.vue'), hidden: true },
  { path: '/main', name:'数据看板', component: () => import('@/views/screen/mainDashboard'), hidden: true },
  { path: '/map', name:'地图', component: () => import('@/views/screen/mapView'), hidden: true },
  { path: '/404', component: () => import('@/views/errorPage/404.vue'), hidden: true },
  { path: '/401', component: () => import('@/views/errorPage/401.vue'), hidden: true },
  // { path: '/', name: 'index', component: () => import('../views/index.vue') },
  { path: '/', redirect: '/main'},
  { path: '*', redirect: '/404',hidden: true}
]

const router = new VueRouter({
  // mode: "history", // 后端支持可开
  scrollBehavior: ()=>({y:0}), // 每次跳转后是滚动条回到头部位置
  routes: constantRoutes
})

export default router
