问题如下?

小程序 文章 2022-01-10 16:00 279 0 全屏看文

AI助手支持GPT4.0

问题如下?Questions are as follows?

问题如下?

小程序获取后端接口返回的带有的'n'字符串没有正确显示换行,如何在后台接口里直接换行后并正确显示到小程序页面上

The string with ' n' returned by the applet from the back-end interface does not display the line feed correctly. How to wrap the line directly in the background interface and display it correctly on the applet page

回答:

一壶炊烟煮黄昏:

小程序该行加上 wxss


white-space: pre-line;
CherisH:

n应该被转义了,匹配转化一下就行,replace(/\n/,'n')

brave:

字符串是吗?你需要写在 text 标签内才会解析,或者在 js 处理换行符

-EOF-

AI助手支持GPT4.0