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: { }, })