You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
radios field now support array of string or array of objects (with name and value properties) by default. If radiosOptions is defined, these key can be replaced by other name, but this is no longer mandatory to use the array of object notation.
if (isObject(item) &&this.schema.radiosOptions.value&& item[this.schema.radiosOptions.value]){
40
-
return item[this.schema.radiosOptions.value];
32
+
if (isObject(item)){
33
+
if (typeofthis.schema["radiosOptions"] !=="undefined"&&typeofthis.schema["radiosOptions"]["value"] !=="undefined") {
34
+
return item[this.schema.radiosOptions.value];
35
+
} else {
36
+
if (typeof item["value"] !=="undefined") {
37
+
returnitem.value
38
+
} else {
39
+
throw"value is not defined.\r If you want to use another key name, add a `value` property under `radiosOptions` in the schema.\r https://icebob.gitbooks.io/vueformgenerator/content/fields/radios.html#radios-field-with-object-values";
40
+
}
41
+
}
42
+
} else {
43
+
return item;
41
44
}
42
-
43
-
return item;
44
45
},
45
46
getItemName(item) {
46
-
if (isObject(item) &&this.schema.radiosOptions.name&& item[this.schema.radiosOptions.name]){
47
-
return item[this.schema.radiosOptions.name];
47
+
if (isObject(item)){
48
+
if (typeofthis.schema["radiosOptions"] !=="undefined"&&typeofthis.schema["radiosOptions"]["name"] !=="undefined") {
49
+
return item[this.schema.radiosOptions.name];
50
+
} else {
51
+
if (typeof item["name"] !=="undefined") {
52
+
returnitem.name
53
+
} else {
54
+
throw"name is not defined.\r If you want to use another key name, add a `name` property under `radiosOptions` in the schema.\r https://icebob.gitbooks.io/vueformgenerator/content/fields/radios.html#radios-field-with-object-values";
55
+
}
56
+
}
57
+
} else {
58
+
return item;
48
59
}
49
-
50
-
return item;
60
+
},
61
+
onSelection(item) {
62
+
this.value=this.getItemValue(item);
51
63
},
52
64
isItemChecked(item) {
53
-
let currentValue;
54
-
if (isObject(item) &&this.schema.radiosOptions.value&& item[this.schema.radiosOptions.value]){
0 commit comments