I am facing an issue with my Vue instance where I need to pass JSON data from the backend without using HTTP requests because the data is constant.
I attempted to achieve this using props, but encountered some challenges... In the DOM, it appears as
<div id="my-component" prices="[object Object]">
The Vue debug tool shows the image as an empty string, and the console displays undefined
<div id="my-component" :prices="{{ $prices }}">
</div>
<script>
new Vue({
el: '#my-component',
props: ['prices'],
mounted: function() {
console.log(this.image);
},
});
</script>
where $prices
represents a json-encoded array.