Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- plot in r
- setstate
- 값삭제
- await
- 이스케이프시퀀스
- 백준 10172
- vetor
- getline
- React
- 배열추가
- 데이터분석
- 버스분석
- barplot in r
- asynchronization
- 그래픽
- 백준
- 탈출문자
- useState
- R 그래프
- barplot
- 배열삭제
- 10172
- 백준 11718
- DataFrame
- 값추가
- 그대로 출력하기
- react #회원가입 #비밀번호비교
- R데이터형태
- 광명시버스분석
- 이용현황분석
Archives
- Today
- Total
devlog_zz
vue Study - event (child to Parent) 본문
728x90
event (child to Parent) : primitive type의 경우 자식에서 변경하여도 부모에서는 변경이 안되므로 이벤트를 통해 전체가 변경되도록 한다.
child에서 수정 시 event를 통해 parent에게 전달하고 parent는 이벤트를 수신하면 listen한다.
변경하는 이벤트를 수신하였을 때 parent의 데이터가 변경되고 -> 새롭게 변경된 데이터를 props를 통해 다른 컴포넌트에 전달된다.
데이터가 변경되면 루트 컴포넌트에서 자식컴포넌트들을 다시 렌더링함 업데이트 된 데이터를 props를 통해 전달
this.$emit('changeTitle','Vue Wizards');
emit을 하여 자식컴포넌트에서 루트로 이벤트를 보내면 루트컴포넌트에서 listen함 - 이벤트와 함께 보내는 문자열로 바뀜
<app-header v-bind:title="title v-on:changeTitle="updateTitle($event)"></app-header>
methods:{
updateTitle:function(updatedTitle){
this.title=updatedTitle; //updatedTitle은 전달받은 string인자 ( 'vue wizards')
}
}
728x90
'Front End > Vue' 카테고리의 다른 글
vue study - life cycle hooks (0) | 2020.03.26 |
---|---|
vue Study - event bus (0) | 2020.03.26 |
vue study - primitive type vs reference type (0) | 2020.03.26 |
vue study - props (0) | 2020.03.25 |
vue study - nesting component (0) | 2020.03.25 |
Comments