Here is some pseudo code that I've written:
var vm = new Vue({
el: '#test',
data: {
words: [{name:'1'}, {name:'2'}, {name:'3'},{name:'4'},{name:'5'},{name:'6'}],
},
computed: {
paginatedWords: function (words) {
return vm.words.slice(2, 2);
}
}
});
I am trying to display only a section of words
using v-for
.
Below is the corresponding HTML code:
<ul>
<li v-for="w in paginatedWords"> @{{w.name}} </li>
</ul>
However, I keep encountering this error message in the console:
Error in render function: "TypeError: Cannot read property 'words' of undefined"
Any idea what mistake I might be making?