You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Adaptive Card选项集值切换容器可见性问题排查

Adaptive Card 日期容器可见性切换问题解决方法

你遇到的问题是Adaptive Cards可见性逻辑的表达式写法不符合规范,以下是修正方案及错误原因说明:

错误原因分析

  1. 错误引用triggerOutputs:卡片内部控件的交互逻辑无需使用triggerOutputs,直接通过控件ID(feature_choice)引用其值即可。
  2. 错误使用conditions属性:Adaptive Cards中不存在conditions这个控制可见性的属性,容器类元素的可见性控制应使用when属性。
  3. contains表达式不适用:此处需要精确匹配选项值,contains是包含匹配逻辑,不符合需求。
  4. when属性表达式格式错误:你当前的${feature_choice.value == 'Date Wise Leave'}不是Adaptive Expression Language(AEL)的正确写法。

正确代码实现

将date_selection_container的when属性修改为AEL的精确匹配表达式即可:

{
    "type": "Input.ChoiceSet",
    "id": "feature_choice",
    "label": "Which type of leave information you needed?",
    "placeholder": "Please Select the feature type",
    "value": "Monthly Leave",
    "choices": [
        {
            "title": "Monthly Leave",
            "value": "Monthly Leave"
        },
        {
            "title": "Date Wise Leave",
            "value": "Date Wise Leave"
        },
        {
            "title": "Recent 5 Leave",
            "value": "Recent 5 Leave"
        }
    ],
    "isRequired": true,
    "wrap": true,
    "separator": true
},
{
    "type": "Container",
    "id": "date_selection_container",
    "padding": "None",
    "when": "=equals(feature_choice.value, 'Date Wise Leave')",
    "items": [
        {
            "type": "Input.Date",
            "label": "From",
            "id": "start_date_input"
        },
        {
            "type": "Input.Date",
            "label": "To",
            "id": "end_date_input",
            "value": "2023-04-27"
        }
    ]
}

额外注意事项

  • 确保你的Adaptive Cards版本在v1.2及以上(when属性从v1.2开始支持)。
  • 确认宿主环境(如Teams、Power Automate、Power Apps等)支持Adaptive Expression Language语法。

内容的提问来源于stack exchange,提问作者Himanshu Rajput

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 14:45:13