냥코딩쟝
vue.js기초- 백엔드와 연결
-js notes-/vue.js 2022. 9. 30. 21:35

Axios UserList: http://localhost:8080/test-user/listUserInfo: http://localhost:8080/test-user/info 백엔드의 RestAPI를 호출하기 위해서 axios를 설치 한다.Axios란? https://github.com/axios/axios 1) Axios 설치 > npm install axios vue-axios --save 2) axios 함수 파일 생성 다음과 같이 axios를 처리하는 함수를 만들어서 사용하도록 한다. /src/store/apiUtil.js import axios from 'axios' const api = axios.create() export default api 향후 위 파일에서 api.interceptor..

vue 기초-vue.js의 구성
-js notes-/vue.js 2022. 9. 30. 21:27

mixin http://localhost:8080/test-mixin mixin을 활용하면 전역변수나 전역메소드 같은 효과를 줄 수 있다.다음과 같은 mixin파일을 생성한다. (위치나 이름은 자유롭게 설정할 수 있다.) /src/components/mixin/commonMixin.js export default { data() { return { mixin: { test: 'mixinTest' } } }, methods: { mixinTest() { console.log('This is mixin method') } } } 다음과 같은 테스트 파일을 생성한다. /src/views/TestMixin.vue Mixin Test{{ mixin.test }} import 할때 @/components/mixin..

vue 기초 코드
-js notes-/vue.js 2022. 9. 30. 21:22

User //:to → 바뀔수 있는 Home replace prop를 설정하면 클릭할 때 router.push() 대신 router.replace()를 호출할 것이므로 내비게이션은 히스토리 레코드를 남기지 않을 것입니다. → 뒤로가기로 남기지 않는다 router link 가 모든것이 가능하다 router와 a태그와 다른점이 처음부터 다운받기 때문에 router를 쓰는것이 낫다 SPA의 특징//무엇을 모르는지 공부 MyTest vue파일 로딩 실행 -life cycle component - create-없는것을 쓸려고할때(마운트를 하기위한 조건) mounte-모든 요소가 준비가 될때 beforeCreated --> created --> beforeMount --> mounted (–> beforeUpdat..