Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use momentJs to make a countdown component

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to use momentJs to do a countdown component, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Vue and moment did a countdown.

Display style:

{{item}}: {{item}}: {{item}} import moment from 'moment'export default {props: {endTime: {}, / / the last time received is 2021-12-17 16:29:20}, data () {/ / the data is stored here. MRV, sRV, timer:null} }, watch: {endTime: {handler (e) {if (e) {let self = this clearInterval (this.timer) this.timer = setInterval (function () {self.init ()}, 1000)}, deep: true, immediate: true}} Mounted () {let self = this self.init () clearInterval (this.timer) this.timer = setInterval (function () {self.init ()}, 1000)}, / / method collection methods: {init () {let time = moment (this.endTime) .diff (moment ()) if (time)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report