[Vuejs]-Is there a way to return html in a javascript function?

1👍

You have to just put you html in quotes like:

export default class Page {
    static createPage() {
        return (
          `<p>hey</p>
           <p>hey</p>
           <p>hey</p>
           <p>hey</p>
          `
        )
    }
}

v-html will parse it as html.

👤Rajeev

0👍

export default class Page {
    static createPage() {
        return (
            "<p>hey</p>"
        )
    }
}

This should work perfectly fine. It will append the HTML string in the desired place.

Leave a comment