-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnTime.vue
45 lines (41 loc) · 884 Bytes
/
AnTime.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
<template>
<input
:id="field_id"
v-model="field_data"
type="time"
placeholder="hh:mm"
required
class="an-time"
/>
</template>
<script>
import field from '@/mixins/field.js';
export default {
name: 'AnTime',
mixins: [field],
created() {
if (!this.field_data) {
const currentTime = new Date();
const hour = String(currentTime.getHours()).padStart(2, '0');
const minute = String(currentTime.getMinutes()).padStart(2, '0');
this.field_data = `${hour}:${minute}`;
}
},
methods: {
validate(value) {
this.$emit('update:field_valid', !!value);
}
}
};
</script>
<style lang="scss" scoped>
.an-time {
border: 1px solid #5e5e5e;
border-radius: $border-radius;
padding: $spacer;
.an-checkboxes_activefields &,
.an-field__subfields & {
border: 2px solid $color-theme-lightgrey;
}
}
</style>