5

我正在尝试在 newSelectionInput OnChangeAction 上将部分小部件动态添加到 Card/CardService,该卡已添加。

我没有在谷歌上看到任何文档,如何实现这种行为。

有人可以指导我找到正确的文档或如何做到这一点。

谢谢

4

1 回答 1

0

我们可以从卡中添加/删除已经内置在输入字段的 onchange 操作中的部分。

function getCard(addSection) {

 // this is your function to build the card. The initial "getCard" function call does not have any parameter passed, so it will be treated as "false". Hence no section will be added 

 addSection = addSection || false;
 
 if(addSection) {
 // add your section here
 }
 .....
 return card;
}

function OnChangeAction() {
  var card = getCard(true);
  return CardService.newActionResponseBuilder().setNavigation(CardService.newNavigation().updateCard(card)).build()
}

我希望这能解决你的问题。

于 2018-02-27T13:55:32.923 回答