我目前正在制作一些动态生成的卡,但是由于某些原因,当我尝试将此卡添加为自适应卡时,整个网络聊天都会崩溃。
我尝试将JSON作为不带双引号的对象,带双引号的字符串以及带双引号的对象传递。
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"id": "header",
"items": [
{
"type": "ColumnSet",
"id": "headerColSet",
"columns": [
{
"type": "TextBlock",
"id": "actionTextCol",
"items": [
{
"type": "TextBlock",
"id": "actionText",
"text": "Action Here!",
"horizontalAlignment": "Right"
}
],
"width": "stretch"
},
{
"type": "TextBlock",
"id": "actionTextCol",
"items": [
{
"type": "TextBlock",
"id": "actionText",
"text": "Action Here!",
"horizontalAlignment": "Right"
}
],
"width": "stretch"
}
]
}
]
},
{
"type": "ColumnSet",
"id": "columnSet1",
"columns": [
{
"type": "Column",
"id": "columnIndex0",
"items": [
{
"type": "TextBlock",
"id": "textOne1",
"text": "Test text One"
}
],
"width": "stretch"
},
{
"type": "Column",
"id": "columnIndex0",
"items": [
{
"type": "TextBlock",
"id": "textTwo1",
"text": "Sec Text One"
}
],
"width": "stretch"
}
]
},
{
"type": "ColumnSet",
"id": "columnSet2",
"columns": [
{
"type": "Column",
"id": "columnIndex1",
"items": [
{
"type": "TextBlock",
"id": "textOne2",
"text": "Test text 2"
}
],
"width": "stretch"
},
{
"type": "Column",
"id": "columnIndex1",
"items": [
{
"type": "TextBlock",
"id": "textTwo2",
"text": "Sec Text 2"
}
],
"width": "stretch"
}
]
},
{
"type": "Container",
"id": "footer",
"items": [],
"separator": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
此JSON应该能够附加到网络聊天中的自适应卡上,但整个屏幕变白并引发这些错误
card-elements.js:2330未捕获的TypeError:无法读取null的属性“ internalValidateProperties”
index.js:1375在observeActivity TypeError上未被发现:无法读取null的属性'internalValidateProperties'
答案 0 :(得分:0)
您的自适应卡似乎有很多问题,最显着的是ColumnSet
应该具有type
属性设置为Column
的对象数组。另外,TextBlocks
没有items
属性。我强烈建议您使用Adaptive Card Designer来创建卡片。还要看看Adaptive Card Schema Explorer。
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"id": "header",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "New TextBlock"
}
]
}
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
希望这会有所帮助!