Ich versuche, einen Requisitenwert und einen Formularwert an den Backend-Controller mit Axios übergeben. Aber es sendet nur einen Formularwert, nicht den Requisitenwert. Mein Code ist -Pass mehrere Parameter von POST Axios Vue
<template>
<form @submit.prevent='onSubmit'>
<div class="media-comment">
<input type="text" v-model='form.comment' class="form-control" placeholder="comment...">
</div>
</form>
</template>
<script>
export default {
props: ['postId'],
data() {
return {
form: new Form({comment: ''}),
id: this.postId
}
},
methods: {
onSubmit() {
console.log(this.postId); // it shows the value in console but the value doesnt pass
this.form
.post('comments', this.data)
.then(post => this.$emit('completed', comment));
}
}
}
</script>
in der Konsole zeigt nur den Kommentar, nicht die Stütze Wert:
Wie beiden Werte passieren ??
Dank im Voraus
Haben Sie versucht, '.post ({Beitrag: this.data, id: this.id}' – Phorce