From 4f205b15e572255422ffb21944474a03e36804d5 Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Mon, 13 May 2024 14:34:54 +0900 Subject: [PATCH] Feat: Add router --- src/router/index.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 24de19f..aa56cfd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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'), }, ], },