[Vue.js] url 뒤에 붙는 #(hashtag) 없애기
2019. 1. 13. 18:42ㆍStudy/Vue.js
반응형
브라우저로 볼 때 자꾸 url 뒤에 #이 붙는다.
예를들어 http://127.0.0.1:8080/#/ 이런식으로
vue-router 설정인 src/router/index.js에 한 줄만 추가해주면 된다. (vue cli를 이용하여 webpack 사용)
import Vue from 'vue'; import Router from 'vue-router'; import HelloWorld from '@/components/HelloWorld'; Vue.use(Router); export default new Router({
mode: 'history',
routes: [ { path: '/', name: 'HelloWorld', component: HelloWorld, }, ], });
mode: 'history' 를 주면 뒤에 # 붙는 현상은 없어진다.
반응형
'Study > Vue.js' 카테고리의 다른 글
| [Vue.js] ubuntu에 nginx 설치하고 vue.js 설치하기 (1) | 2019.02.01 |
|---|---|
| [vue.js] Eventbus 만들기 (0) | 2018.10.22 |
| [Vue.js] 페이징 로직 (0) | 2018.10.22 |
| [Vue.js] promise 사용하기 (0) | 2018.09.20 |
| [Vue.js] class를 만들어 vue객체 사용하기 (0) | 2018.09.20 |
| [Vue.js] mixin 전역 등록하기 (0) | 2018.09.20 |
| [vue] img src data binding (0) | 2018.09.07 |
| vue.js radio button 토글 이벤트 걸기 (0) | 2018.07.12 |