Closed joa77 closed 4 years ago
How to change the text to something else instead of displaying 00:00, if the countdown elapsed?
00:00
<countdown :time="timeLeft" :transform="transform"> <template slot-scope="props">{{ props.minutes }}:{{ props.seconds }}</template> </countdown>
var app = new Vue({ el: '#app', data: function () { var now = new Date(); return { timeLeft: new Date('2020-10-15T00:05:32.000Z') - now, } }, methods: { transform(props) { Object.entries(props).forEach(([key, value]) => { props[key] = value < 10 ? `0${value}` : value; }); return props; }, }, })
Just follow the Fetch Verification Code demo.
In short, use v-if and v-else.
v-if
v-else
How to change the text to something else instead of displaying
00:00
, if the countdown elapsed?