Can you help with passing objects as props in Vue? It seems like a simple task, but I'm having some trouble.
In my .vue
file, I have the following code:
<template>
<div id="scatter"></div>
</template>
<script>
export default {
props: {
data: {
type: Object,
default: () => ({}),
},
},
mounted() {
console.log(this.data);
},
};
</script>
In the HTML, I attempt to pass the data
prop like this:
<component :data="{x:1}"></component>
However, when I try to log it to the console, all I see is an empty observer object.