Feat: Add router

This commit is contained in:
jhynsoo 2024-05-13 14:34:54 +09:00
parent aedf8f5824
commit 4f205b15e5

View File

@ -1,5 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';
import HomeView from '@/views/HomeView.vue';
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@ -10,26 +10,23 @@ const router = createRouter({
component: HomeView,
},
{
path: '/article',
name: 'article',
//index.html이 화면에 표시될때 미리 다운 받지 않고 필요시 동적으로 페이지를 다운 받는다.
component: () => import('@/views/ArticleView.vue'),
redirect: { name: 'article-list' },
path: '/board',
component: () => import('@/views/BoardView.vue'),
children: [
{
path: 'list', //children은 /를 자동으로 붙여 주므로 빼야 한다.
name: 'article-list',
path: '',
name: 'board',
component: () => import('@/components/article/ArticleList.vue'),
},
{
path: 'regist',
name: 'article-regist',
component: () => import('@/components/article/ArticleRegist.vue'),
path: '/article/:id',
name: 'article',
component: () => import('@/components/article/ArticleDetail.vue'),
},
{
path: 'detail',
name: 'article-detail',
component: () => import('@/components/article/ArticleDetail.vue'),
path: '/article/form',
name: 'article-create',
component: () => import('@/components/article/ArticleForm.vue'),
},
],
},