Answer the question
In order to leave comments, you need to log in
How to pass parameter to cumputed Vue.js?
Task: you need to attach your own timer for the reverse time for each element. Each element has its own time.
What I do: I created a setInterval that pushes the current time to the variable every second.
Created 2 computed properties:
getMinutes: function (time) {
return Math.trunc((time - this.now) / 1000 / 60) % 60;
},
getSeconds: function (time) {
return ((time - this.now) / 1000) % 60;
}
{{ getMinutes(item.offer_timestamp) }} : {{ getSeconds(item.offer_timestamp) }}
Answer the question
In order to leave comments, you need to log in
Use filter instead of computed
https://ru.vuejs.org/v2/guide/filters.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question