如何按名称导航到卡片

时间:2019-05-14 13:42:54

标签: gmail-addons

我正在构建gmail附加组件,但卡之间的导航似乎没有 在下面工作是我的代码。如何在制作的卡片之间导航?

function buildAddOn(e){

 var card = CardService.newCardBuilder()
 var section = CardService.newCardSection() 
 var action = CardService.newAction().setFunctionName('Nav')



 card.setHeader(CardService.newCardHeader().setTitle('EIn'))  





 makeAChoice.setTitle('Make a Choice')
 makeAChoice.setFieldName('userChoice')
 makeAChoice.setOnChangeAction(CardService.newAction()
 .setFunctionName('saveChoice'))

 for(var i=1;i<7;i++){
    makeAChoice.addItem('Choice ' + i, i, (i==7)?true:false);
 }




 section.addWidget(CardService.newTextInput()
.setFieldName('Quantity').setTitle('Quantity'))




 section.addWidget(CardService.newTextInput()
 .setFieldName('Product').setTitle('Product'))





  section.addWidget(CardService.newTextButton()
 .setText('Next').setOnClickAction(action))

 card.addSection(section)
 return card.build()
 //---------------------------------------------------------------------- 
 ----------------------------

}


function otherCards() {

  var card = CardService.newCardBuilder().setName('Card2')
  var section = CardService.newCardSection()
  var action = CardService.newAction().setFunctionName('Nav')
 //=====================================================================
 ===========================

  card.setHeader(CardService.newCardHeader().setTitle('Card2'))
  section.addWidget(CardService.newTextInput()
  .setFieldName('Name').setTitle('Name'))
  section.addWidget(CardService.newTextInput()
 .setFieldName('Address').setTitle('Address'))

  section.addWidget(CardService.newTextButton()
 .setText('Next').setOnClickAction(action))

  card.addSection(section).build();

 //=======================================
  ==========================================================
  var nav = CardService.newNavigation().pushCard(card);
  return [CardService.newActionResponseBuilder()
    .setNavigation(nav)
    .build(), nav]

}

function Nav() {
   var nav = CardService.newNavigation().popToNamedCard('Card2');
   return CardService.newActionResponseBuilder()
    .setNavigation(nav)
    .build();
}

0 个答案:

没有答案