I have 'vue2-editor', so good working. I want this values send post with formData,
How can I capture the data in it?
Thanks for Helps..
My Editor Component
<template>
<div>
<uax-editor id="editor"></uax-editor>
</div>
</template>
<script>
import { VueEditor } from "vue2-editor";
export default {
components: {
"uax-editor": VueEditor
}
};
</script>
<style></style>
My Form Example..
<form id="formData" @submit="submitForm" enctype="multipart/form-data">
...
<app-editor class="mt-1"></app-editor>
...
</form>
This is my Form. Inputs and Images working with FormData, i need editor values :)
My codes now working, thanks for Alireza HI
<template>
<div>
<uax-editor id="editor" :value="editor" @input="val => $emit('update:editor', val)"></uax-editor>
</div>
</template>
<script>
import { VueEditor } from "vue2-editor";
export default {
components: {
"uax-editor": VueEditor
},
props: {
editor: {
type: String,
default: '',
}
}
};
</script>
<style>
</style>
and...
<app-editor class="mt-1" :editor.sync="editor"></app-editor>
and...
export default {
data() {
return {
image: '',
editor: ''
};
},
components: {
"app-editor": ThisEditor,
"app-single-update": ThisSingleImageUpdate
},
methods: {
submitForm() {
event.preventDefault();
var formData = new FormData(document.getElementById("formData"));
formData.append('desc', this.editor);
console.log(this.editor);
for (var pair of formData.entries()) {
console.log(pair[0] + ", " + pair[1]);
}
axios({
method: 'POST',
url: 'http://localhost:3001/uax_designers_addOne',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(function(response){
console.log(response);
}).catch(function(error){
console.log(response);
});
}
