node.js - MS Bot Framework nodejs sdk:在自适应卡片中显示长文本
问题描述
我正在使用自适应卡片在我的机器人应用程序中显示文本消息。我正在使用 ms bot 框架 nodejs sdk 版本 3。我在显示长文本消息时遇到问题。他们正在被截断。请在下面找到代码:
[
{ type: 'TextBlock',
text: 'Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.' },
{ type: 'TextBlock',
text: ' Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.' }
]
在自适应卡内显示长文本数据而不被截断的最佳方法是什么?
谢谢
解决方案
您需要在对象中设置wrap
属性以防止文本在 AdaptiveCard 中被截断。我建议查看AdaptiveCard Designer以获得更多样式选项。TextBlock
true
自适应卡
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
"wrap": true
},
{
"type": "TextBlock",
"text": "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
"wrap": true
},
{
"type": "TextBlock",
"text": "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
"wrap": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
截屏
希望这可以帮助!
推荐阅读
- c++ - 为什么 float 和 double 不能在小数位上识别 0
- java - 如何将方法作为参数传递?
- python - 关于 Monty Hall 问题的程序未返回预期结果
- google-apps-script - 输入数据后锁定谷歌表格中的单元格
- r - 在一个图中绘制不同的列 R
- html - 粘性页脚不会停留
- c# - Oracle Managed Data Reader 为一个数据库表返回 DBNull
- sql - 查看多行以获取列值的 SQL 查询
- ubuntu - 恐慌:缺少“x86”CPU 的模拟器引擎程序。在 Ubuntu 上
- java - Tableview不显示新添加的数据,仅在重新启动程序后显示(javafx)