Files
csgowtf/src/router/index.js
2021-10-05 00:16:20 +02:00

49 lines
837 B
JavaScript

import { createRouter, createWebHistory } from 'vue-router'
function lazyLoad(view) {
return () => import(`@/views/${view}.vue`)
}
const routes = [
{
path: '/',
name: 'Home',
component: lazyLoad('Home')
},
{
path: '/player/:id',
name: 'Player',
component: lazyLoad('Player'),
props: true
},
{
path: '/player/:id/matches',
name: 'MyMatches',
component: lazyLoad('MyMatches'),
props: true
},
{
path: '/match/:match_id',
name: 'Match',
component: lazyLoad('Match'),
props: true
},
{
path: '/explore',
name: 'Explore',
component: lazyLoad('Explore'),
props: true
},
{
path: '/:pathMatch(.*)*',
redirect: '/'
}
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router