1👍
✅
You can use props for passing data from parent to children https://vuejs.org/guide/components/props.html
PostComponents.vue
<template>
// bind the child props with your data that will be passed
<ModalComponent v-show="isModalVisible" @close="closeModal" :dataFromParent='dataFromApi' />
</template>
data() {
return {
// define data that will be passed to children
dataFromApi: '',
}
},
ModalComponents
<script>
export default {
props: {
// define name and type of the props
dataFromParent: Object,
}
};
// you can access the props object
console.log(props.dataFromParent)
</script>
after the props already setup, you need to insert some data to the data that will be passed to children, so when the editPost
function already done fetching data, insert that response data to the variable that will be passed to children
Source:stackexchange.com