import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const originalPush = Router.prototype.push

Router.prototype.push = function push (location) {

return originalPush.call(this, location).catch(err => err)

}

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
        path: '/',
        redirect:'/index',
    },
    {
      path: '/index',
      name: 'index',
      component: () => import ('./views/index.vue'),
    },
    {
      path: '/court',
      name: 'court',
      component: () => import ('./views/court.vue'),
    },
    //智慧节能
    {
        path: '/energySaving',
        name: 'energySaving',
        component: () => import ('./views/energySaving.vue'),
      },
    //智慧安防
    {
        path: '/security',
        name: 'security',
        component: () => import ('./views/security.vue'),
      },
    //智慧运维
    {
        path: '/operationMaintenance',
        name: 'operationMaintenance',
        component: () => import ('./views/operationMaintenance.vue'),
      },
    //告警管理
    {
        path: '/alarm',
        name: 'alarm',
        component: () => import ('./views/alarm.vue'),
      },
  ]
})
