The situation looks dead simple but the reason is absolutely not clear to me. I'm trying to implement one Vue component for a project with legacy code using ES5. Vue library is 2.6x (also tried 2.5x).
I have the following Vue component:
window.StoragesPage = Vue.extend({
name: MyConsts.COMP_STORAGES_PAGE,
template: '#storages-page-template',
data: function () {
return {
msg: 'aaaaaaaaaa',
instGid: '',
instDomain: ''
};
},
});
it has the following template:
<script type="x-template" id="storages-page-template">
<div> {{ msg }} </div>
</script>
and it uses the following way of instantiation:
Vue.component(MyConsts.COMP_STORAGES_PAGE, window.StoragesPage);
// Init vue root instance
new Vue({
el: '#my-app'
});
and a markup for Vue root instance looks like:
<div id="my-app">
<storages-page></storages-page>
</div>
and my constant with the component name looks like:
...
COMP_STORAGES_PAGE: 'storages-page',
...
Finally I have this Vue warning:
vue-2x.js:634 [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. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. (found in Root)
The question are:
Why I see this warning at all?
Why it contains "found in Root", but "msg" data item actually is inside my Vue root child component?
Why after that I see properly rendered page with expected output "aaaaaa"?
PS: I also have double-checked that there is only one Vue library included on the page.