I found a few questions like mine, but none were clear enough to solve my specific problem.
I have this code in my Test.Vue component that is imported into my App.vue file.
P.S. Everything was working perfectly fine yesterday when I was working on this, I wasn't getting any error at all doing this. I just closed my laptop and today opened it up again to work on it and started getting this error when I refreshed my page.
<template>
<div class = "test">
<input type="text" v-model="title"> <br/>
<h1>{{title}}</h1>
<p>{{user.lastName}}</p>
<p v-if="showName">{{user.firstName}}</p>
<p v-else>Nada</p>
<!-- <ul>
<li v-for="item in items>{{item.title}}</li>
</ul> -->
</div>
</template>
<script>
export default {
name: 'test',
data() {
return{
title: 'Hello World',
user: {
firstName:'John',
lastName:'Doe'
},
showName: true,
// items: [
// {title: 'Item One'},
// {title: 'Item Two'},
// {title: 'Item Three'}
// ]
}
}
}
</script>
<style scoped>
</style>
With what I have in my code -- having commented the lines that create in my <template>
and the items:[] in , everything
vue.esm.js?efeb:1741 TypeError: Cannot read property 'title' of undefined at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-dc87507c","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/Test.vue (0.b8f1eab6988182beecb6.hot-update.js:7), :37:59) at VueComponent.Vue._render (vue.esm.js?efeb:4544) at VueComponent.updateComponent (vue.esm.js?efeb:2788) at Watcher.get (vue.esm.js?efeb:3142) at Watcher.run (vue.esm.js?efeb:3219) at flushSchedulerQueue (vue.esm.js?efeb:2981) at Array.eval (vue.esm.js?efeb:1837) at flushCallbacks (vue.esm.js?efeb:1758)