12345678910111213141516171819202122232425 |
- let app = new Vue({
- el: '#app',
- data () {
- return {
- time: '',
- timer: '',
- }
- },
- created () {
- this.time = formatDate()
- this.timer = setInterval(() => {
- this.time = formatDate()
- }, 1000)
- },
- beforeDestroy () {
- if (this.timer) {
- clearInterval(this.timer);
- }
- },
- mounted () {
- },
- methods: {
- },
- })
|