Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use v-html to wrap text by semicolon in vue

Shulou Source: shulou.com Published: 2022-05-31 13:15:07 10月04日 Update

This article "how to use v-html in vue to wrap the text by a semicolon" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use v-html in vue by semicolon to wrap the text" article.

As follows:

Before changing careers: Lei Jun, 24.5766 million, natural person shareholder; Hong Feng, 1.6951 million, natural person shareholder; Li Wanqiang, 103300, natural person shareholder

After changing the line:

Lei Jun, 24.5766 million, natural person shareholder

Hong Feng, 1.6951 million, natural person shareholder

Li Wanqiang, 103300, natural person shareholder

Html displayed:

Js:

Methods: {change:function (content) {content = content.replace (/; / g, ";"); content = content.replace (/; / g, ";); return content;}}

You can also write:

Methods: {change:function (content) {var reg = / [;] / g; content = content.replace (reg, "$&\ r\ n"); return content;}}

However, in the process of writing, it is found that the console output shows that the conversion has been successful, but the effect seen on the page is that the conversion has not been successful. Later, I found that I need to add a white-space: pre-wrap; style to the current tag on the page, as follows:

The above is about the content of this article on "how to use v-html to wrap text by semicolon in vue". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Shareholders natural persons content semicolons text success articles knowledge articles pages Lei Jun Wanqiang value most that is console effects more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia macOS Apple Linux OPPO Reno