·

Vue add whitespaces in a string

Published at 2024-05-09 20:18:57Viewed 242 times
Professional article
Please reprint with source link

In Vue.js, if you simply add multiple whitespaces in a string, it eventually displays a single whitespace.

//This will display a single whitespace.
'ab   c'

If you want to display multiple whitespaces, you could use unicode to represent whitespace.

let str1 = 'ab\u00A0\u00A0\u00A0 c';
let str2 = 'ab\u0020\u0020\u0020 c';
let str3 = 'ab\u3000\u3000\u3000 c';

These will output multiple whitespaces in strings.

Comments

There is no comment, let's add the first one.

弦圈热门内容

Vertically aligning CSS :before and :after content

I am trying to centre the link with the image, but can't seem to move the content vertically in any way.<h4>More Information</h4> <a href="#" class="pdf">File Name</a>The icon is 22 x 22px.pdf { font-size: 12px; } .pdf:before { padding:0 5px 0 0; content: url(../img/icon/pdf_small.png); } .pdf:after { content: " ( .pdf )"; font-size: 10px; } .pdf:hover:after { color: #000; }

Get connected with us on social networks! Twitter

©2024 Guangzhou Sinephony Technology Co., Ltd All Rights Reserved