Skip to content

Commit

Permalink
docs: add line-break faq
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed May 21, 2024
1 parent e8de2dd commit 9c31d29
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/assets/faq/en/22-How to deal with line-break.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# How to deal with line-break

## Problem Description

How to handle newline character `\n` in VTable?

## solution

Line breaks are not parsed by default in VTable and will be drawn as a space in canvas. You can enable newline parsing by configuring `enableLineBreak: true`. At this time, the newline characters in the string will be parsed into newlines, and the string will be parsed into multiple lines.

```
const option = {
//......
enableLineBreak: true,
}
```

## Related documents

- [Tutorial](https://www.visactor.io/vtable/option/ListTable#enableLineBreak)
- [github](https://github.com/VisActor/VTable)
7 changes: 7 additions & 0 deletions docs/assets/faq/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@
"zh": "21.怎么取消表格mousedown事件的冒泡?",
"en": "21.How to cancel the bubbling of the table event?"
}
},
{
"path": "22-How to deal with line-break",
"title": {
"zh": "22.怎么处理换行符?",
"en": "22.How to deal with line-break?"
}
}
]
}
21 changes: 21 additions & 0 deletions docs/assets/faq/zh/22-How to deal with line-break.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 怎么处理换行符

## 问题描述

如何在VTable中处理换行符`\n`

## 解决方案

在 VTable 中默认不会解析换行符,在canvas中会被绘制为一个空格。可以通过配置`enableLineBreak: true`来开启换行符解析,此时字符串中换行符会被解析为换行,字符串会被解析为多行。

```
const option = {
// ......
enableLineBreak: true,
}
```

## 相关文档

- [教程](https://www.visactor.io/vtable/option/ListTable#enableLineBreak)
- [github](https://github.com/VisActor/VTable)

0 comments on commit 9c31d29

Please sign in to comment.