[App.vue]
<template>
<Container :게시물="게시물" />
</template>
<script>
import Container from './components/ContainerVue.vue';
import postData from './assets/postData.js'
export default {
name: 'App',
data(){
return{
게시물 : postData,
}
},
components: {
Container : Container,
}
}
</script>
[ContainerVue.vue]
<template>
<div>
<Post :게시물="게시물[0]"/>
</div>
</template>
<script>
import Post from './PostVue.vue';
export default {
components: {
Post : Post,
},
porps : {
게시물 : Array,
}
}
</script>
코드인데
<Post :게시물="게시물[0]"/> 이 부분에서 [0]을 넣으면 타입오류가 나옵니다..ㅠㅠ
Uncaught TypeError: Cannot read properties of undefined (reading '0')