Add save button
This commit is contained in:
parent
c0a18e8ee1
commit
4dd0fc4c4b
|
@ -113,7 +113,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<navigation v-if="active === index" v-model="active" :last="v.sections.length"></navigation>
|
||||
<navigation v-if="active === index" :as-form="asForm" v-model="active" :last="v.sections.length"></navigation>
|
||||
</slide>
|
||||
</carousel>
|
||||
</div>
|
||||
|
@ -156,7 +156,7 @@ const {colClassesForField, containerClasses} = useColumns();
|
|||
const finished = ref(false);
|
||||
const eventForm = ref(null);
|
||||
|
||||
const emits = defineEmits(['addSection', 'editSection', 'deleteSection', 'editField', 'deleteField', 'active']);
|
||||
const emits = defineEmits(['addSection', 'editSection', 'deleteSection', 'editField', 'deleteField', 'active', 'save']);
|
||||
|
||||
const props = defineProps({
|
||||
editable: {
|
||||
|
@ -179,6 +179,10 @@ const props = defineProps({
|
|||
default: () => false,
|
||||
type: Boolean,
|
||||
},
|
||||
asForm: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
},
|
||||
});
|
||||
|
||||
const active = ref(0);
|
||||
|
@ -227,6 +231,10 @@ const {back, next, backable, nextable} = useNav(active, v.value.sections.length)
|
|||
const {resolveComponentName} = useFields();
|
||||
|
||||
async function submit() {
|
||||
if (props.asForm) {
|
||||
emit('save', payload.value);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await axios.post('/api/form/' + props.formId + '/register', payload.value);
|
||||
finished.value = true;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
Anmeldung absenden
|
||||
<span v-text="asForm ? 'Speichern' : 'Anmeldung absenden'"></span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -29,6 +29,10 @@ const props = defineProps({
|
|||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
asForm: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const innerValue = computed({
|
||||
|
|
Loading…
Reference in New Issue