在选项提示中将选项列表呈现为按钮的正确方法是什么? [英] What is the correct way to render options list as buttons in choice prompt?
问题描述
我正试图以按钮的形式向用户展示可供选择的选项,例如:
I am trying to present options to the user to chose from in the form of buttons, like this:
builder.Prompts.choice( session, "Do you want to raise a ticket for this problem?", "Yes|No",
{
maxRetries: 3,
retryPrompt: 'Sorry, that is not a valid input'
},
{
listStyle: builder.ListStyle.button
}
);
但是,网络聊天频道显示如下:
However, the web chat channel shows this like so:
很显然,这样做有问题,但我不确定是什么. 如何正确使用带有按钮的选择提示?
Obviously there is something wrong in the way it is done, but I'm not sure what. How do I correctly use choice prompts with buttons ?
推荐答案
您需要重组提示选项,使其看起来像下面的示例.在代码中,您将选项分为两个参数.结果,该方法仅看到您的第一组选项,并且默认为简单列表.进行此更改,它将正确呈现.
You need to restructure you prompt options to look like the below example. In your code, you separated the options out into two parameters. The method, as a result, is only seeing your first set of options and is defaulting to a simple list. Make this change and it will render correctly.
builder.Prompts.choice(session, "Do you want to raise a ticket for this problem?", "Yes|No",
{
maxRetries: 3,
retryPrompt: 'Sorry, that is not a valid input',
listStyle: builder.ListStyle.button
}
);
这篇关于在选项提示中将选项列表呈现为按钮的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!