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

//公共
import routesCommon from './common'
//访客
import routesGuest from './guest'
//业主
import routesMaster from './master'
//监管
import routesControl from './control'
//其他
import routesOther from './other'

import routesXsy from '../router-xsy/xsy'

import routesHome from './home'

if (!window.VueRouter) Vue.use(VueRouter)

const routesIndex = [
	
]

const routes = routesIndex.concat(routesCommon, routesGuest, routesMaster, routesControl, routesOther,routesXsy,routesHome);

const router = new VueRouter({
	//base: process.env.BASE_URL,
	routes,

	// keep-alive 返回缓存页面后记录浏览位置  
	scrollBehavior(to, from, savedPosition) {
		if (savedPosition) {
			return savedPosition;
		} else {
			return {
				x: 0,
				y: 0
			}
		}
	},

})

export default router
