Function: truncateText()
ts
function truncateText(
text,
maxLength,
ellipsis?): string;Truncates text with ellipsis. 截断文本并追加省略号。
Parameters
| Parameter | Type | Default value |
|---|---|---|
text | string | undefined |
maxLength | number | undefined |
ellipsis | string | '...' |
Returns
string
Example
ts
truncateText('Hello World', 8) // => 'Hello...'Since
1.0.0