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

213
Views
¿Cómo analizar \n después de unir una matriz a una cadena en VueJS?

En mi código Vue.JS, tengo una matriz en el objeto que analicé en una cadena como esta:

 destination: item[1].destination.join('\n')

En console.log(obj) puedo ver que se ve así:

destination: "test1\ntest3\ntest3"

Pero en la página parece una cadena común, sin \n .

ingrese la descripción de la imagen aquí

¿Cómo puedo analizarlo para que HTML vea esos \n ?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Debe usar style="white-space: pre-line" en su componente html

over 4 years ago · Santiago Trujillo Report

0

Si tiene una variedad de elementos, intente seguir el siguiente enfoque

 let app = new Vue({ el: '#app', data() { return { textData: ['Text1\nText2\nText3', 'Text4\nText5\nText6'] }; }, });
 .sampleDiv { white-space: pre-line; }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <div class="sampleDiv" v-for="(text, index) in textData" :key="index">{{text}}</div> </div>

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!