-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdate.vue
71 lines (67 loc) · 1.72 KB
/
date.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div class="main is-unselectable">
<span class="title" v-bind:class="theme">{{date}}</span>
</div>
</template>
<script>
import moment from 'moment';
import storage from '../../helpers/storage';
import store from '../../store';
const widget_name = 'date';
const manifest = {
name: widget_name, // Widget name
description: 'Simple date widget',
settings: {
format: {
name: 'Date format',
value: 'dddd, Do MMMM YYYY',
tooltip: 'More info: momentjs.com',
type: 'string'
},
},
layout: { // default layout
i: widget_name, // Must be the same name
x: 8,
y: 7,
w: 8,
h: 1,
},
};
export default {
name: manifest.name,
data: () => ({
date: '',
}),
manifest: manifest,
computed: {
settings(){
return store.getters.settings[manifest.name];
},
dark(){
return store.getters.settings.mdash.dark.value;
},
theme(){
return {
'has-text-white': this.dark,
'has-text-black': !this.dark,
};
},
},
mounted() {
this.date = moment().format(this.settings.format.value);
},
watch:{
'settings.format.value'() {
this.date = moment().format(this.settings.format.value)
}
}
};
</script>
<style scoped>
.main {
text-align: center;
/*border: solid black 2px;*/
/*height:300px;*/
font-family: 'Lato', sans-serif;
}
</style>