When I attempted to display the name 'John' using an inline template in a simple Vue example, I encountered the following error message:
[Vue warn]: Property or method "name" 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://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
Surprisingly, when I switched to the minified version of Vue:
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="afd9dacaef9d8199819d">[email protected]</a>/dist/vue.min.js"></script>
The code successfully displayed 'John' without any errors. Could this be a bug or am I overlooking something in my use of Vue?
Vue.component('profilecontent', {});
var content = new Vue({
el: '#profile-content-wrapper',
data: {
name: "John",
}
})
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8dfbf8e8cdbfa3bba3bf">[email protected]</a>/dist/vue.js"></script>
<!-- Minify version works
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e181b0b2e5c4058405c">[email protected]</a>/dist/vue.min.js"></script>
-->
<div id="profile-content-wrapper">
<profilecontent inline-template>
<div>
<div>{{name}}</div>
</div>
</profilecontent>
</div>