Here is an example from the book "The Majesty of Vue", it works fine. But I was trying to make the code shorter and failed.
So in the computed properies there is a function:
search: function(){
var query = this.query
return this.stories.filter(function(story){
return story.plot.includes(query)
});
I tried to remove var query = this.query
and add directly to return story.plot.includes(this.query)
. But this way it doesn't work.
Why? Isn't it the same?