How do you keep passing objects as props to vue? I would suggest that this will be a simple task, but apparently not.
I have the following code in a .vue file:
`
<template>
<div id="scatter"></div>
</template>
<script>
export default {
props: {
data: {
type: Object,
default: () => ({})
}
},
mounted () {
console.log(this.data)
}
}
</script>
`
In html, I am trying to pass the details dataas follows:
<component :data="{x:1}"></component>
When I try to enter the console, the result will be only an empty observer object.
source
share