条件($when)在json自适应卡的容器迭代中



我有一个"字段"我想用适配卡显示。我想显示的信息取决于字段类型。我用一个容器跑过我的田地。对于每个字段,我想显示一个类型依赖于fieldType的Input。

我不能找到一种方法使用条件时美元。

在json下面,我试图移动"$"在不同的地方("$when": "${fieldType == 1}","$when": "{$fieldType} == 1}","$when": "{$fieldType == 1}"…),但我认为文档说要这样写。

这是自适应卡片模板的一部分

{
"type": "Container",
"$data": "${attributeData.data}",
"spacing": "medium",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "${fieldName}",
"wrap": true
},
{
"type": "Input.Text",
"$when": "${fieldType == 1}",
"id": "${fieldId}",
"placeholder": "Add a comment",
"isMultiline": true,
"value": "${fieldValue}"
},
{
"type": "Input.Date",
"$when": "${fieldType == 2}",
"id": "${fieldId}",
"value": "2017-09-20"
}
]
}

以下是部分数据

{
"attributeData": {
"data": [
{
"fieldId": 1,
"fieldName": "Texte libre 1",
"fieldValue": "Voici un texte",
"fieldType": 1
},
{
"fieldId": 2,
"fieldName": "Montant libre 1",
"fieldValue": "101",
"fieldType": 0
},
{
"fieldId": 3,
"fieldName": "birthDate",
"fieldValue": "2001-05-19",
"fieldType": 2
}
]
}
}

有人知道怎么做吗?也许有别的方法可以得到我需要的东西?

感谢您的宝贵时间

我通过更新adaptivecrads包修复了这个问题…

最新更新