html - angular过滤器中返回的字符串怎么换行
迷茫
迷茫 2017-05-15 17:06:10
0
2
1554

加n换不了行 只会显示个空格
比如过滤器中最后return "湖北\n江苏"

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
phpcn_u1582

Reason: When HTML renders the page, multiple spaces or line breaks will be merged into one space and displayed on the page

Solution:

  1. You can use the <pre></pre> tag when rendering the page and insert the returned string into this tag.

      pre 标签可定义预格式化的文本。被包围在 pre 标签中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体
    
  2. Use "<br/>" tag to replace line

小葫芦

Uh-huh. . The webpage does not recognize n.

split("n") gets the new array, and then generates a new tag with <br/> insert it into a new line

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!