我正在尝试创建一个以英雄卡列表为选项的提示对话框。
我创建了一个函数,该函数将返回 herocard 列表并将其用作对话框提示选项。
我怎样才能做到这一点?或者有更好的方法来实现它。注意:我需要把它放在对话提示中,因为我需要实现一个顺序对话。我还将英雄卡列表放在一个单独的函数中,因为我将在其他对话框提示中使用它。
async selectProduct(stepContext){
return await stepContext.prompt(CHOICE_PROMPT, {
prompt: 'Select Product:',
choices: this.productChoices()
});
}
productChoices(){
const productSeriesOptions = [
CardFactory.heroCard(
'Title 1',
CardFactory.images(['image URL 1']),
CardFactory.actions([
{
type: ActionTypes.ImBack,
title: 'Title 1',
value: 'Value 1'
}
])
),
CardFactory.heroCard(
'Title 2',
CardFactory.images(['image URL 2']),
CardFactory.actions([
{
type: ActionTypes.ImBack,
title: 'Title 2',
value: 'Value 2'
}
])
)
];
return productSeriesOptions;
}
Run Code Online (Sandbox Code Playgroud)