const login = r => require.ensure([], () => r(require('@/views/Login.vue')), 'Login'); //登录页
const notFound = r => require.ensure([], () => r(require('@/views/404.vue')), 'NotFound'); //404页面

/* 引入route 拼接 */
const rootRoutes = [];
const importAllRoutes = (r) => {
	r.keys().forEach(key => {
		// console.log(r(key).default)
		rootRoutes.push(...r(key).default)
	})
}
importAllRoutes(require.context('./modules',true,/\.js$/))

let routes = [
	{
		path: '',
		redirect: '/login'
	},
	{
		path: '*',
		redirect: {
			path: '/404'
		},
		hidden: true
	},
	{
		path: '/login',
		component: login,
		name: '',
		hidden: true
	},
	{
		path: '/temppage',
		component: ()=>import('@/views/transferPage.vue'),
		name: '',
		hidden: true
	},
	{
		path: '/404',
		component: notFound,
		name: '',
		hidden: true
	},
	...rootRoutes,
];

export default routes;