---
# System prepended metadata

title: Vue.js 완벽 가이드 - 라우팅
tags: [석기]

---

Vue.js 완벽 가이드 - 라우팅
===

###### tags: `석기`

---

## 라우팅

```javascript=
import Vue from 'vue';
import VueRouter from 'vue-router';

import AskView from '../views/AskView.vue';
import JobsView from '../views/JobsView.vue';
import NewsView from '../views/NewsView.vue';
import UserView from '../views/UserView.vue';
import ItemView from '../views/ItemView.vue';

Vue.use(VueRouter);

export const router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/news'
        },
        {
            path: '/news',
            component: NewsView,
        },
        {
            path: '/jobs',
            component: JobsView,
        },
        {
            path: '/ask',
            component: AskView,
        }, 
        {
            path: '/users',
            component: UserView
        },
        {
            path: '/items',
            component: ItemView
        },
    ]
})
```

- routes 객체에 다 때려넣는다.
- mode: history -> 웹 URL에 #붙는거 방지.

