Skip to content

Commit 3306893

Browse files
committed
added "type" attribute to inside buttons schema, defaults to "button" when one is not provided
1 parent a484031 commit 3306893

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/formGroup.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="field-wrap">
1212
<component ref="child" :is="getFieldType(field)" :vfg="vfg" :disabled="fieldDisabled(field)" :model="model" :schema="field" :formOptions="options" @model-updated="onModelUpdated" @validated="onFieldValidated"></component>
1313
<div v-if="buttonVisibility(field)" class="buttons">
14-
<button v-for="(btn, index) in field.buttons" @click="buttonClickHandler(btn, field, $event)" :class="btn.classes" :key="index" v-text="btn.label"></button>
14+
<button v-for="(btn, index) in field.buttons" @click="buttonClickHandler(btn, field, $event)" :class="btn.classes" :key="index" v-text="btn.label" :type="getButtonType(btn)"></button>
1515
</div>
1616
</div>
1717

@@ -81,6 +81,10 @@ export default {
8181
getFieldType(fieldSchema) {
8282
return "field-" + fieldSchema.type;
8383
},
84+
// Get type of button, default to 'button'
85+
getButtonType(btn) {
86+
return objGet(btn, 'type', 'button');
87+
},
8488
// Child field executed validation
8589
onFieldValidated(res, errors, field) {
8690
this.$emit("validated", res, errors, field);

0 commit comments

Comments
 (0)