vue.js propsプロパティ
🌱 vueのpropsプロパティについて
🔸 重要🔸
(emitとは逆)
props 속성 작성 방법)
<!-- HTML에서의 kebab-case -->
<template>
<child-component post-title="hello!"></child-component>
</template>
...
<script>
Vue.component('child-component', {
//----- JavaScript에서의 camelCase
props: ['postTitle(props속성 이름)'],
template: '<h3>{{ postTitle }}</h3>'
})
</script>
props 속성 작성 예시)
<template>
<div id='test'> ----- id.test로 연결해준 👉 상위 컴포넌트 부분!!
<child-component :peopleData='name'>
상위로부터 props 받은 하위 컴포넌트 부분
</child-component>
</div>
</template>
<script>
Vue.component('child-component',{
props: ['peopleData'],
template: '<p>{{peopleData}}</p>'
})
</script>
Reference
この問題について(vue.js propsプロパティ), 我々は、より多くの情報をここで見つけました https://velog.io/@park0eun/vue.jsprops-속성テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol