// 路由
import {
	RouterMount,
	createRouter
} from 'uni-simple-router';
const router = createRouter({
	platform: process.env.VUE_APP_PLATFORM,
	applet: {
		animationDuration: 100 //默认 300ms 
	},
	// 通配符，非定义页面，跳转404
	routes: [
		{
			path: '*',
			redirect: (to) => {
				return {
					name: '404'
				}
			}
		},
	]
});

//全局路由前置守卫
router.beforeEach((to, from, next) => {
	console.log('跳转结束')
	// 权限控制登录
	if (to.meta && to.meta.auth) {
		next(false);
	} else {
		next()
	}
});
router.afterEach((to, from) => {})

export {
	router,
	RouterMount
}