我正在为我的移动应用程序项目使用bone.js。我的问题是如何在段落中添加“ br”?这是我的代码。
<p><%= product.get('description') %></p>
数据库中的数据
The COOLPIX S620 combines beauty and brains.
It features the worlds fastest start up in just 0.7 seconds.
我想要的就是这样
The COOLPIX S620 combines beauty and brains.
It features the worlds fastest start up in just 0.7 seconds.
不是这个
The COOLPIX S620 combines beauty and brains. It features the worlds fastest start up in just 0.7 seconds.
您可以在javascript中使用正则表达式在每个句子后添加换行符。
大写字母后的期间的搜索参数为 /\.(?=[A-Z])/g
description.replace(/\.(?=[A-Z])/g, '<br />');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句