js如何处理字符串中带有↵字符

js或vue中如何处理字符串中带有↵字符

split('
')

使用split(' ')将字符串分割成数组就行

如果我们在vue中,只需要在页面中绑定变量时操作split(' ')就可以了:

<p  v-for="_item in item.question.split('
')">{{_item}}</p>

上面代码中:我在v-for循环绑定变量时,直接对变量操作split(' ')

原文地址:https://www.cnblogs.com/momozjm/p/8296328.html