Does the heavy use of computed in vue affect performance?

The

project needs to achieve a countdown effect, which converts the countdown seconds returned by the background to days, hours, minutes and seconds, and needs to achieve the countdown effect of refreshing every second at the front end.
my idea is to keep the remaining seconds-1 in the timer, and then calculate the days, minutes and seconds in computed according to the remaining seconds, but due to the style requirements, the days, minutes and seconds are each in two digits and need to be divided into two data, that is, {{day1}} {{day2}} days {{hour1} {hour2}} {{min1} {min2}} {{sec1} {{sec2}} seconds , Will so much computed affect performance? Is there a better solution? Thank you.

Jun.04,2021

well, let me talk about pad . padStart the first parameter is the total length, and the second parameter is the placeholder. Well, is there no need for two variables? Do numerical calculations once a second, there is no pressure.

clipboard.png

clipboard.png

Menu