Skip to content

Commit

Permalink
added "type" attribute to inside buttons schema, defaults to "button"…
Browse files Browse the repository at this point in the history
… when one is not provided
  • Loading branch information
zoul0813 committed Dec 10, 2018
1 parent a484031 commit 3306893
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/formGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="field-wrap">
<component ref="child" :is="getFieldType(field)" :vfg="vfg" :disabled="fieldDisabled(field)" :model="model" :schema="field" :formOptions="options" @model-updated="onModelUpdated" @validated="onFieldValidated"></component>
<div v-if="buttonVisibility(field)" class="buttons">
<button v-for="(btn, index) in field.buttons" @click="buttonClickHandler(btn, field, $event)" :class="btn.classes" :key="index" v-text="btn.label"></button>
<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>
</div>
</div>

Expand Down Expand Up @@ -81,6 +81,10 @@ export default {
getFieldType(fieldSchema) {
return "field-" + fieldSchema.type;
},
// Get type of button, default to 'button'
getButtonType(btn) {
return objGet(btn, 'type', 'button');
},
// Child field executed validation
onFieldValidated(res, errors, field) {
this.$emit("validated", res, errors, field);
Expand Down

0 comments on commit 3306893

Please sign in to comment.