【发布时间】:2019-08-05 02:41:25
【问题描述】:
我目前正在做一个学校项目,几乎完成了。我有一个管理面板,我在其中列出了我的博文,我想限制文本字段,这样当它达到 150 个字符时,它会中断并输入 3 个点“...”..
列表的代码在这里:
<tr th:each = "blog: ${blogs}">
<th th:text="${blog.title}" scope="row"></th>
<td><p th:text="${blog.text}"></p></td>
<td><p th:text="${blog.author}"></p></td>
<td><p th:text="${blog.date}"></p></td>
<td><a th:href="@{/blog/delete/{id}(id=${blog.id})}"class="btn btn-danger">Delete</a><a th:href="@{/blog/update/{id}(id=${blog.id})}" class="btn btn-info ml-2">Edit</a></td>
</tr>
我尝试在谷歌上搜索,但找不到解决方案。
感谢您的帮助!
/尼克
【问题讨论】:
-
感谢您的解决方案。它工作得很好,但我还是想知道百里香的语法,因为我还想在博文上做一个“阅读更多”按钮,所以如果博文超过 150 个字符,你可以按阅读更多查看完整博文