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

Vue.use(VueRouter)

const routes = [
	{path: '/',redirect: '/provideUnit'},
	{path: '/provideUnit',name: 'provideUnit',component: () => import('../views/provideUnit/provideUnit.vue'),meta: { 	keepAlive: true,}},
	{path: '/receiveApply',name: 'receiveApply',component: () => import('../views/receiveApply/receiveApply.vue'),meta: { 	keepAlive: true,	isBack: false,}},
	{path: '/informedConsentForm',name: 'informedConsentForm',component: () => import('../views/informedConsentForm/informedConsentForm.vue'),},
	{path: '/applyRecord',name: 'applyRecord',component: () => import('../views/applyRecord/applyRecord.vue'),meta: { 	keepAlive: true,	isBack: false}},
	{path: '/provideDetail',name: 'provideDetail',component: () => import('../views/provideDetail/provideDetail.vue')},
	{path: '/receiveDetail',name: 'receiveDetail',component: () => import('../views/receiveDetail/receiveDetail.vue')},
	{path: '/canvas',name: 'canvas',component: () => import('../views/canvas/canvas.vue')},
	{path: '/questionAnswer',name: 'canvas',component: () => import('../views/questionAnswer/questionAnswer.vue')},
]

const router = new VueRouter({
  	routes
})
router.afterEach((to, from) => {
	// 让页面回到顶部
	(document.documentElement.scrollTop = 0) || (document.body.scrollTop = 0);
	// 调用 next()，一定要调用 next 方法，否则钩子就不会被销毁
   	// next();
})

export default router
