自适应卡输入编号中的预设值

发布于 2025-02-01 13:28:28 字数 327 浏览 4 评论 0 原文

如何使用数据上下文将值设置为 input.number

这些自适应卡都不可用:

{
      "type": "Input.Number",
      "placeholder": "id",
      "id": "MyId",
      "value": "$root.MyId"
}

{..., "value": $root.MyId }

{..., "value": "${$root.MyId}" }

{..., "$data": "${$root}" }

{..., "$data": "${$root.MyId}"}

How to set a value to an Input.Number using data context?

None of these Adaptive cards work:

{
      "type": "Input.Number",
      "placeholder": "id",
      "id": "MyId",
      "value": "$root.MyId"
}

{..., "value": $root.MyId }

{..., "value": "${$root.MyId}" }

{..., "$data": "${$root}" }

{..., "$data": "${$root.MyId}"}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拒绝两难 2025-02-08 13:28:28

这是一个示例,这是有效的:

您只是略微删除了语法。

这应该有效:

{
   "label": "Job Title",
   "type": "Input.Text",
   "placeholder": "Persons's Job Title",
   "value": "${$root.jobTitle}",
   "id": "job"
}

here's one example thats working:
https://github.com/DeeJayTC/AdaptiveCardsPeopleApp/blob/master/AdaptiveCardsVuePeople/src/assets/personCreate.json

You just had your syntax slightly off.

This should work:

{
   "label": "Job Title",
   "type": "Input.Text",
   "placeholder": "Persons's Job Title",
   "value": "${$root.jobTitle}",
   "id": "job"
}
演出会有结束 2025-02-08 13:28:28

您可以将Input.number用作类型,但是您想通过占位符设置值并设置数据。然后,值的上下文将全部属于密钥“ root”。使用$ {root.myid}之类的子键,我发现使用input.number时无法正确反映编辑。因此 -

"type": "Input.Number",
"placeholder": "${MyId}",
"data": "${root}"

当数据为:

"root": [
{ 
"key": "MyId", "value": "934"}
]

you can use input.number as the type, but you want to set the value via placeholder and also set the data. Then the context of the values would all be under the key "root". Using subkeys like ${root.MyId} i find doesn't reflect correctly edit when using Input.Number. So like -

"type": "Input.Number",
"placeholder": "${MyId}",
"data": "${root}"

when the data is:

"root": [
{ 
"key": "MyId", "value": "934"}
]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文