export default defineNuxtRouteMiddleware(async (to, from) => { // const router = useRouter() // const responseRoute = await $fetch('http://apipre1.bjzxtw.org.cn:29501/web/getWebsiteParentCategory', { // headers: { // 'Content-Type': 'application/json', // 'Userurl': 'http://apipre1.bjzxtw.org.cn:29501', // 'Origin': 'http://apipre1.bjzxtw.org.cn:29501' // } // }) // //添加所有分类页路由 // for(let index in responseRoute.data.parent){ // if(responseRoute.data.parent[index].path!=undefined){ // router.addRoute({ // path: responseRoute.data.parent[index].path, // component: () => import('~/pages/primaryNavigation/[id].vue'), // meta: { // isAlias: true, // routeId: responseRoute.data.parent[index].cid, // routeName: responseRoute.data.parent[index].name // } // }) // } // } // //添加所有列表路由 // for(let index in responseRoute.data.child){ // if(responseRoute.data.child[index].path!=undefined){ // router.addRoute({ // path: responseRoute.data.child[index].path, // component: () => import('~/pages/newsList/[id].vue'), // meta: { // isAlias: true, // routeId: responseRoute.data.child[index].cid, // routeName: responseRoute.data.child[index].name // } // }) // } // } // console.log('进入路由中间件,目标路由:', to.path, "当前路由:", from.path); })