1👍
✅
You are shadowing the comment
property defined on the component with the comment
variable declared inside the v-for
. So v-model="comment.body"
references the comment
loop variable, was this intended?
So now this.comment.body
in the method will always be an empty string, as opposed to comment.body
.
What is the purpose of the comment
data property? I would expect this is so that you can only edit one comment at a time and it will contain data related to the comment being edited, but you are binding to the individual comment.body
in the template and passing the loop comment
object to editComment()
, so that isn’t the case.
Source:stackexchange.com