-
Notifications
You must be signed in to change notification settings - Fork 1
/
AnToggle.vue
65 lines (60 loc) · 1.15 KB
/
AnToggle.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
<template>
<fieldset class="an-toggle">
<input
v-show="!$store.state.printMode"
:id="`${field_id}--0`"
v-model="field_data"
type="radio"
:name="field_id"
:value="false"
/>
<label
v-show="!$store.state.printMode || !field_data"
:for="`${field_id}--0`"
>{{ fieldText[0] }}</label
>
<input
v-show="!$store.state.printMode"
:id="`${field_id}--1`"
v-model="field_data"
type="radio"
:name="field_id"
:value="true"
/>
<label
v-show="!$store.state.printMode || field_data"
:for="`${field_id}--1`"
>{{ fieldText[1] }}</label
>
</fieldset>
</template>
<script>
import field from '@/mixins/field.js';
export default {
name: 'AnToggle',
mixins: [field],
props: {
fieldText: {
type: Array,
default: () => ['Nein', 'Ja']
}
},
methods: {
validate(value) {
this.$emit('update:field_valid', value !== undefined);
}
}
};
</script>
<style lang="scss" scoped>
label {
@media print {
margin-left: 0;
}
&:first-of-type {
@media screen {
margin-right: $spacer * 2;
}
}
}
</style>