📝 Edit page
➕ Add page
Whitespace
Show a value as multi-line text.
text = "abc\n\ndef"
Use CSS.
<div style="white-space: pre-line">
</div>
Or you can replace \n
with <br>
and also use v-html
so it sets as innerHTML
rather than just as literal \n
text. But it has a security concern if you use user-generated data.
text.replace(/(?:\r\n|\r|\n)/g, '<br />');