Answer the question
In order to leave comments, you need to log in
Why is the computed property not overridden?
There is a computed property
formattedDate() {
let date = this.date ? this.date : this.value;
return date ? moment(date).format(this.getFormat) : date;
}
Answer the question
In order to leave comments, you need to log in
In fact, it is very strange that it does not work either when moving from a computed property to a method, or when using this.$set. And forceUpdate did not help.
The only way to fix it is to create a formattedDate reactive prop and put the formatted date there in the setSelectedDate method.
Something like this
Everything is very interesting. I dare to suggest that you store an object in the this.date variable, thereby you return a link! On the this.date object is visible.
Try writing something like let date = this.date ? JSON.parse(JSON.stringify(this.date)) : ...
If it works as expected, then you have an architectural error and need to think about it.
Also computed properties are cached, don't forget that.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question