split('\n')

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

 

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

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

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

相关文章:

  • 2021-12-21
  • 2021-11-30
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2021-05-31
  • 2022-12-23
  • 2021-06-18
相关资源
相似解决方案