I have an App.vue where I load a form with input fields (component). Submitting method works but I am not getting any data from the form input field title.
How can I achieve that?
App.vue:
<form v-on:submit.prevent="getFormValues">
<page-header :title="'Banner toevoegen'"></page-header>
<form-input :label="'title'" :labelvalue="'Titel'" :type="'text'" :placeholder="''" :name="'title'" :value="''" :classname="'form-control'" :id="''"></form-input>
<form-input :label="''" :labelvalue="''" :type="'submit'" :placeholder="''" :name="'title'" :value="'banner toevoegen'" :classname="'form-control'" :id="''"></form-input>
</form>
AND method
methods: {
getFormValues (submitEvent) {
this.name = submitEvent.target.elements.title.value
console.log(this.title)
},
Input.vue:
<template>
<div>
<div class="form-group">
<label v-if="label" :for="label" v-html="labelvalue"></label>
<input :type="type" :placeholder="placeholder" :name="name" :value="value" :class="classname" :id="id">
</div>
</div>
</template>
<script>
export default {
props: {
type: String,
placeholder: String,
name: String,
value: String,
classname: String,
id: String,
label: String,
labelvalue: String
}
}
</script>