mirror of
https://github.com/cupcakearmy/dvb.git
synced 2024-11-06 01:24:11 +01:00
29 lines
503 B
JavaScript
29 lines
503 B
JavaScript
|
Vue.component('dvb-date', {
|
||
|
template: `<div id="date">{{cur}}</div>`,
|
||
|
data() {
|
||
|
return {
|
||
|
hz: 3,
|
||
|
cur: '...',
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
update() {
|
||
|
this.cur = new Date().toLocaleDateString('de-DE', {
|
||
|
weekday: 'short',
|
||
|
year: 'numeric',
|
||
|
month: 'numeric',
|
||
|
day: 'numeric'
|
||
|
})
|
||
|
},
|
||
|
startWatcher() {
|
||
|
this.update()
|
||
|
this.watcherId = setInterval(this.update, this.hz * 1000)
|
||
|
},
|
||
|
stopWatcher() {
|
||
|
clearInterval(this.watcherId)
|
||
|
},
|
||
|
},
|
||
|
mounted() {
|
||
|
this.startWatcher()
|
||
|
},
|
||
|
})
|