How to display the line feed of characters in data normally

The string from the back end has line breaks:

 

 The effect of direct output:

 

 

 Solution demo:

<p class="" v-html="text"></p>
js:
let str=res.rows[0].text.replace(/\n/g,"<br/>")
               this.text = str
effect:

 

 

Guess you like

Origin www.cnblogs.com/wd163/p/12739964.html