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
- 이용현황분석
- 10172
- 광명시버스분석
- barplot in r
- 버스분석
- R 그래프
- 배열삭제
- getline
- 백준 11718
- 탈출문자
- 데이터분석
- asynchronization
- setstate
- await
- react #회원가입 #비밀번호비교
- vetor
- 이스케이프시퀀스
- 그래픽
- R데이터형태
- DataFrame
- 값삭제
- React
- 배열추가
- 값추가
- 백준 10172
- 그대로 출력하기
- barplot
- useState
Archives
- Today
- Total
devlog_zz
vue study - props 본문
728x90
props : 부모컴포넌트에서 자식컴포넌트에게 전달
자식 컴포넌트 - Ninjas.vue
export default {
props:['ninjas'] // 이렇게 받음
}
}
부모 컴포넌트 - App.vue
<app-ninjas v-bind:ninjas="ninjas"></app-ninjas>
단순 string을 전달할 때는 ninjas="ninjas"하면 되는데 object 니까 v-bind이용해야 함
method에서 접근하기
methods:{
test:function(){
this.ninjas
}
}
유효성 검증
props:{
ninjas:{
type:Array, // type이 array인지 확인, 아닐 시에는 오류 발생
required:true //??전달 되는ㄱ지?
}
}
type : 전달되는 데이터의 타입 확인! - 넘어오는 데이터는 ~타입만 가능하다
required : 반드시 필요할 때 사용(부모컴포넌트에서 자식컴포넌트를 사용할 때 반드시 값을 넣어줘야 한다
728x90
'Front End > Vue' 카테고리의 다른 글
vue Study - event (child to Parent) (0) | 2020.03.26 |
---|---|
vue study - primitive type vs reference type (0) | 2020.03.26 |
vue study - nesting component (0) | 2020.03.25 |
vue study - nested component (0) | 2020.03.25 |
vue Study - Refs (0) | 2020.03.25 |
Comments