Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

374
Views
Mostrar HTML sin escape en Vue.js

¿Cómo puedo lograr que HTML se interprete dentro de un enlace de bigote? En este momento, el descanso ( <br /> ) solo se muestra/escapa.

Pequeña aplicación Vue:

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

Y aquí está la plantilla:

 <div id="logapp"> <table> <tbody> <tr v-repeat="logs"> <td>{{fail}}</td> <td>{{type}}</td> <td>{{description}}</td> <td>{{stamp}}</td> <td>{{id}}</td> </tr> </tbody> </table> </div>
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede usar la directiva v-html para mostrarlo. Me gusta esto:

 <td v-html="desc"></td>
over 4 years ago · Santiago Trujillo Report

0

Comenzando con Vue2, las llaves triples quedaron obsoletas, debe usar v-html .

<div v-html="task.html_content"> </div>

No está claro en el enlace de documentación qué se supone que debemos colocar dentro v-html , sus variables van dentro v-html .

Además, v-html solo funciona con <div> o <span> pero no con <template> .

Si quieres ver esto en vivo en una aplicación, haz clic aquí .

over 4 years ago · Santiago Trujillo Report

0

Puedes leer eso aquí

Si utiliza

 {{<br />}}

se escapará. Si quieres html sin procesar, debes usar

 {{{<br />}}}

EDITAR (5 de febrero de 2017): como señala @hitautodestruct, en vue 2 debe usar v-html en lugar de llaves triples.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!