I don't know why but this error Property 'myfunc' was accessed during render but is not defined on instance is keeps on showing. I am sharing my Html and js code.
const ListRenderingApp = {
data() {
return {
todos: [
{ text: 'Learn JavaScript' },
{ text: 'Learn Vue' },
{ text: 'Build something awesome' }
]
}
},
method : {
myfunc(){
console.log('drats')
}
}
}
Vue.createApp(ListRenderingApp).mount('#list-rendering')
And the Html files code is
<div id="list-rendering" class="demo">
<ol>
<li v-for="todo in todos">
{{ todo.text }}
</li>
</ol>
<button v-on:click="myfunc"> Click me</button>
</div>
I am very new to Vue.js. So, if anyone can please help me with this question.