QuillEditor can't inject post.content on update route

Viewed 27

I am building my first CRUD app on Vue.js with node server and MongoDB. I implemented the QuillEditor and it's working wonderfully to create my post, send the HTML content as a string to MongoDB and then display it on the website as HTML.

I do have a problem when I try to update the content, the QuillEditor is empty. I cannot find a way to inject the content back inside

This is how I call the component in the template:

<QuillEditor toolbar="minimal" content-type="html" theme="snow" name="postcontent" id="post-content" v-model:content='post.content' @input="noSubmit" required></QuillEditor>

This is my logic to populate fields with the response from my API

getPost(id) {
  PostService.get(id)
    .then(res => {
      this.post = res.data;
    })
    .catch(error => {
      console.log(error)
    })

The v-model:content="post.content" works like a charm to send the data to the server but doesn't seem to work to inject data back into the editor.

Any idea how to solve this ?

0 Answers
Related