This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfieldElementRadio.vue
63 lines (61 loc) · 1.55 KB
/
fieldElementRadio.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
<template>
<el-form-item :label="schema.elementLabel ? schema.elementLabel : ''">
<el-radio-group
v-if="schema.radioType === 'button'"
v-model="value"
:text-color="schema.textColor"
:fill="schema.fill"
>
<el-radio-button
v-bind:index="index"
v-bind:key="item.label"
v-for="(item, index) in items"
:label="item.label"
:disabled="schema.disabled"
:size="schema.size"
:name="schema.inputName"
:id="schema.id"
:border="schema.border"
>
{{ item.name }}
</el-radio-button>
</el-radio-group>
<el-radio-group
v-else
v-model="value"
:text-color="schema.textColor"
:fill="schema.fill"
>
<el-radio
v-bind:index="index"
v-bind:key="item.label"
v-for="(item, index) in items"
:label="item.label"
:disabled="schema.disabled"
:size="schema.size"
:name="schema.inputName"
:id="schema.id"
:border="schema.border"
>
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
</template>
<script>
import { abstractField } from "vue-form-generator";
import defaultValueSetter from "../mixins/defaultValueSetter";
export default {
name: "fieldElementRadio",
mixins: [abstractField, defaultValueSetter],
computed: {
items() {
const values = this.schema.values;
if (typeof values === "function") {
return values.apply(this, [this.model, this.schema]);
}
return values;
}
}
};
</script>