[Vuejs]-How to insert a new empty line on selected index number in an array using \n. while we loop through it using v-for and create a list

0👍

This is pretty easy to do using the <pre> tag which forces it to preserve white space, new lines, etc. This is often used for preserving formatting in code examples.

 <div id="app">
   <ul>   
     <li v-for = "ninja in ninjas" ><pre>{{ninja}}</pre></li>  
   </ul>
</div>

working example: https://jsfiddle.net/skribe/10yL6va8/8/

You will probably want to use css to style the text surrounded by <pre> since most browsers automatically format it differently.

Leave a comment