0π
β
I can propose you that (and id need to be unique because itβs your key in the for loop)
parent:
<template>
<div>
<User :tileMenu="tileMenu" /> <!--pass all array-->
</div>
</template>
<script>
import User from "./Home.vue";
const tileMenu = [
{ id: 1, name: "tile1NAME" },
{ id: 2, name: "tile2NAME" },
];
export default {
components: {
User,
},
data() {
return {
tileMenu: tileMenu,
};
},
};
</script>
child:
<template>
<div>
<div v-for="tile in tileMenuChild" :key="tile.id">
{{ tile.name }} with id {{ tile.id }}
</div>
</div>
</template>
<script>
export default {
props: {
tileMenu: Array,
},
data() {
return {
tileMenuChild: this.tileMenu,
};
},
};
</script>
Source:stackexchange.com