| 12345678910111213141516171819202122232425262728293031 | 
							- import {
 
- 	createRouter,
 
- } from '@gowiny/uni-router'
 
- import PAGE_DATA from '@/pages.json';
 
- const router = createRouter({
 
- 	pageData: PAGE_DATA
 
- })
 
- router.beforeEach((to, from) => {
 
- 	uni.$grace.showLoading("加载中...");
 
- })
 
- router.afterEach((to, from) => {
 
- 	uni.hideLoading();
 
- 	const oldPath = uni.getStorageSync('oldPath');
 
- 	const path = uni.getStorageSync('path');
 
- 	if (oldPath != null) {
 
- 		uni.setStorageSync('oldPath', path);
 
- 		uni.setStorageSync('path', to.fullPath);
 
- 	} else {
 
- 		uni.setStorageSync('oldPath', to.fullPath);
 
- 		uni.setStorageSync('path', to.fullPath);
 
- 	}
 
- 	// return new Promise((success, fail) => {
 
- 	// 	setTimeout(function() {
 
- 	// 		console.log('afterEach 2 end') success(true)
 
- 	// 	}, 1000)
 
- 	// })
 
- })
 
- export default router;
 
 
  |