<aside> ❗ App.vue(부모 컴포넌트)에서 자식 요소로써 사용할 수 있는 또 다른 vue 파일

</aside>

<template>
	<MyBtn>
		Banana
	</MyBtn>
</template>

<script>
**import MyBtn from '~/components/MyBtn'**

export default {
	**components: {
		MyBtn
	}**
}

props

// 부모 컴포넌트( App.vue)
<template>
	<MyBtn **color="royalblue"**>
		Banana
	</MyBtn>
</template>

// 자식 컴포넌트 (MyBtn.vue)
export default {
	**props**: {
		color: {
			type: String,
			default: ''
		}
	}
}

속성 상속

// 부모 컴포넌트
<template>
	<MyBtn style="color: red">
		Banana
	</MyBtn>
</template>

// 자식 컴포넌트
<template>
	<h1 :style="**this.attrs.style**" :class="**this.attrs.class**">
</template>

또는

<template>
	<h1 **v-bind="this.$attrs"**>
</template>

이벤트 상속

// 부모 컴포넌트
<template>
	<MyBtn **@click**="log"></MyBtn>
</template>

// 자식 컴포넌트
<template>
	<h1 @click="**$emit('click', $event)**"></h1>

<script>
export default {
	**emits: [
		'click'
	]**
}
</script>