trix
trix copied to clipboard
trix-editor not submit my input using v-model in vue
Steps to Reproduce
I have a form where one of the field is using trix-editor. When i submit the form, every field is submit properly except my input using trix-editor. Can anyone give me a clue about it?
<div class="mt-1">
<input id="x" type="hidden" v-model="post.description" />
<trix-editor
input="x"
class="
trix-content
bg-white
shadow-sm
focus:ring-indigo-500
focus:border-indigo-500
mt-1
block
w-full
text-sm
border-gray-300
rounded-md
"
placeholder="Enter your post"
></trix-editor>
</div>
Details
- Trix version: 1.31
- Browser name and version: Chrome
- Operating system: MacOS Big Sur
Try to use this:
methods: {
setTextToTrix: function() {
this.post.description = document.getElementById("x").value;
}
},
mounted() {
document.addEventListener("trix-change", this.setTextToTrix); // Listen to the changes on the editor
}
Hi. sorry for the late reply. Just got time to continuing my side project. Btw thanks, man.