I am trying to load data into my .vue component file from its parent .js file.
This is my .html file:
<div class="modal-container">
<section class="modal">
<modal-component></modal-component>
</section>
</div>
This is my .js file:
var modal = new Vue({
el: 'section.modal',
data: {
msg: 'Hello world!'
},
components: {
'modal-component': httpVueLoader('./templates/test.vue')
}
});
This is my .vue file:
<template>
<section>
<p class="test">{{ msg }}</p>
</section>
</template>
However, when I load the page, this error appears in the console and the value of 'msg' is blank:
[Vue warn]: Property or method "msg" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
msginmodal-component's js file or add a prop for model-component and bind msg to it. Javascript file of model-component is missing in your question.</template>add<script> export default { data: () => { return { msg: "my message" }; } } </script>