Answer the question
In order to leave comments, you need to log in
Issue with Vue.js, [Vue warn]: Error in render?
Good afternoon,
There is a problem with Vue rendering, when executing the code below, it gives an error, but at the same time it executes it.
The code
computed: {
//TODO: vue ругается на sort
sortedArray() {
return this.tasks.sort((a, b) => a.completed - b.completed )
}
},
[Vue warn]: Error in render: "TypeError: this.tasks.sort is not a function"
Answer the question
In order to leave comments, you need to log in
this.tasks is not an array Rethink
your code
Crutch variant
if (!this.tasks) return [];
return this.tasks.sort((a, b) => a.completed - b.completed)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question