小程序获取后端接口返回的带有的'n'字符串没有正确显示换行,如何在后台接口里直接换行后并正确显示到小程序页面上
问题如下?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
回答:
n应该被转义了,匹配转化一下就行,replace(/\n/,'n')
字符串是吗?你需要写在 text 标签内才会解析,或者在 js 处理换行符
原文出处:问题如下?
小程序该行加上 wxss
white-space: pre-line;