【发布时间】:2021-11-02 09:33:11
【问题描述】:
我想在 vue.js
的字符串中使用换行符 (\n)例如:
created() {
this.buttons = [
{
id: 1,
text: "Button \n 1",
},
{
id: 2,
text: "Button \n 2",
},
{
id: 3,
text: "Button \n 3",
},
是否有其他方法可以做到这一点,因为那不起作用?
我不想使用<pre、white-space: pre 或white-space: pre-wrap。
提前谢谢你
【问题讨论】:
-
你为什么不想使用这些?有什么问题吗?
-
可以在javascript字符串中使用这些吗?
-
啊我明白了 - 抱歉读到这里!
-
因为我想在特定空间使用这些
-
见下面的答案 - 这能回答你的问题吗?