애플리케이션 플러그인, 설정을 파악할 수 있는 청사진 이다.

비동기 요청은 http 로 서버로 다녀오기때문에
현재위치의 this 를 벗어난 this 가 생성된다.
따라서 바인딩을
var vm = this; 이런식으로 해주던가
ES6 화살표 함수를 쓰면
호출되는 위치의 this 가져 온다.

Vuex 구조
- 뷰 컴포넌트 -> 비동기 로직 -> 동기로직 -> 상태
- 시작점 Vue Components
- 컴포넌트에서 비동기로직인 Actions 를 콜하고,
- Actions는 비동기 로직만 처리할 뿐 State(Data)를 직접 변경하진 않는다.
- Actions 가 동기로직인 Mutations 를 호출해서 State(Data)를 변경한다.
- Mutations에서만 State(Data)를 변경할 수 있다.
commit : 바꾸겠다고 의사를 나타냄(store 에서 mutation 시킬때)
state.allUSers.push(payload) 로 변경시킬 수 있다. actions: {
async LOGIN({ commit }, userData) { // 객체 형태 안에
// 내가 commit 을 쓸거라고 알려준다.
const { data } = await loginUser(userData);
commit('setToken', data.token);
commit('setUsername', data.resultMap.data.memId);
saveAuthToCookie(data.token);
saveUserToCookie(data.resultMap.data.memId);
return data;
},
},
{ } 객체 안에 commit 을 명시해주므로써
1. dispatch : component 에서 Actions 를 실행시키는 명령어이다.
this.$store.dispatch('addUSers',USerObj)
store 에 'addUsers'라는 actions 를 불러올건데 userObj를 매개변수로 넘길거다.
actions: {
addUsers : ({ commit } ), payload) => {
commit('addUSers', payload)
}
}
this.$store.commit('addUsers',userObj) ==> commit 으로 실행시킨다.
첫번째 줄 : store 에서 addUsers 가 실행되고 addUSers는 mutation 하나를 commit 할 것인데
payload를 받는다. 라고 명시되고
두번째 줄 : 위에서 명시한대로 commit 을 진행할 것이고 addUsers라는 mutation 을 진행할 것이다. ( state 를 변화시키는 한 줄)
출처: https://ict-nroo.tistory.com/108?category=797223 [개발자의 기록습관]
Componet의 레이아웃을잡아주는 역할을 하고
실제 기능은 component 가 작동하도록 구현해야 한다.
https://joshua1988.github.io/web-development/vuejs/slots/
prop 은 data 를 컴포넌트 간에 전달하는 것이고
slot 은 컴포넌트 태그로 감싼 HTML 코드 부분을 그대로 가져와 주는 것을 말한다


여러개의 slot 을 등록할때 name 을 이용해서 등록 할 수 있다.


텍스트