feat: init
This commit is contained in:
37
src/router/index.ts
Normal file
37
src/router/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import NProgress from 'nprogress' // progress bar
|
||||
import 'nprogress/nprogress.css'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
|
||||
import createRouteGuard from './guard'
|
||||
import { appRoutes } from './routes'
|
||||
import { NOT_FOUND_ROUTE, REDIRECT_MAIN } from './routes/base'
|
||||
|
||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory('./'),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
redirect: 'login',
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import('@/views/login/index.vue'),
|
||||
meta: {
|
||||
requiresAuth: false,
|
||||
},
|
||||
},
|
||||
...appRoutes,
|
||||
REDIRECT_MAIN,
|
||||
NOT_FOUND_ROUTE,
|
||||
],
|
||||
scrollBehavior() {
|
||||
return { top: 0 }
|
||||
},
|
||||
})
|
||||
|
||||
createRouteGuard(router)
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user