Rendering unescaped HTML content in Vue.js
P粉253518620
P粉253518620 2023-08-21 19:48:52
0
2
501

How to parse HTML code in mustache binding? Currently newline characters (
) will only be displayed/escaped.

Small Vue application:

var logapp = new Vue({ el: '#logapp', data: { title: 'Logs', logs: [ { status: true, type: 'Import', desc: 'Learn
JavaScript', date: '11.11.2015', id: 1 }, { status: true, type: 'Import', desc: 'Learn
JavaScript', date: '11.11.2015', id: 1 } ] } })

The following is the template:

{{fail}} {{type}} {{description}} {{stamp}} {{id}}

P粉253518620
P粉253518620

reply all (2)
P粉939473759

Starting from Vue2, the three curly braces are deprecated, you need to usev-html.

It's not clear from thedocumentation linkwhat we should put inv-html, your variables should be placed inv-html.

Also,v-htmlonly works with

or, not