There's more...

There is another way to output raw HTML; it is advanced, but it's much cleaner and maintainable, especially if you have a component that depends heavily on HTML formatting.

In these more contrived cases, you can opt for functional components that are covered in detail in the Create a functional component recipe in Chapter 9, Advanced Vue.js - Directives, Plugins and Render Functions, but here you will find an example that is an extension of what we have just done.

The HTML you should write is as follows:

<div id="app">   <thanks gift="Batman" decoration="strong"></thanks> </div>

You can already see that the intent is clear: to write a thank-you note for the batman gift using the HTML <strong> as decoration. The JavaScript ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.