M
M
Mikhail Vasiltsev2018-12-18 18:41:47
JSON
Mikhail Vasiltsev, 2018-12-18 18:41:47

NuxtJS how to display html received via json?

On the backend, a json object with an article is given. On the frontend, I get it, the code is from the NuxtJS project:

async asyncData ({ params, error }) {
      const pst = await axios.get('http://backend/post/?url=' + params.url)
      return {
        post: pst.data
      }
}

Well, then the resulting object is simply rendered. But in the browser, I can see that the html tags are not converted properly, and as a result, the content has no formatting.
5c19150cb7498072136382.jpeg
Seems like a simple problem, but I don't know what to do. There shouldn't be a problem on the backend side. I will be grateful for hints.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sklyarov, 2018-12-18
@mihail430899

it is possible like this:<div v-html="property"></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question