import { createRouter, createWebHistory } from 'vue-router'
import remainingRouter from './modules/remaining'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL), // createWebHashHistory URL带#，createWebHistory URL不带#
  strict: true,
  routes: remainingRouter,
  scrollBehavior: () => ({ left: 0, top: 0 })
})

// export const resetRouter = () => {
//   const resetWhiteNameList = ['Redirect', 'Login', 'NoFind', 'Root']
//   router.getRoutes().forEach((route) => {
//     const { name } = route
//     if (name && !resetWhiteNameList.includes(name)) {
//       router.hasRoute(name) && router.removeRoute(name)
//     }
//   })
// }

export default router
