【发布时间】:2019-02-05 23:32:53
【问题描述】:
我正在使用超过 x 个字符的树枝来缩短两个字符串。如果字符串被缩短,我想添加省略号。我该怎么做而不是使用三个句点?
{
{ title | length > 5 ? title|slice(0,27) ~ &hellip : title }},
{{dept | length > 5 ? title|slice(0,27) ~ '...' :dept }
}
编辑:额外问题:如果标题字符串不为空,我怎样才能只添加逗号?
【问题讨论】: