为botframework v4选择提示应用列表样式:NodeJS [英] Apply list style for botframework v4 choice prompt: NodeJS
问题描述
我正在尝试在botbuilder-dialog的选择中添加列表样式; Botframework v4,NodeJS.
Hi I'm trying to add a list style in the choices of botbuilder-dialog; Botframework v4, NodeJS.
我正在尝试使用下面的代码来实现它,但是列表样式似乎对选择没有任何影响.它应该提示一个编号列表,但是会提示一个类似列表的按钮.
I'm trying to implement it using the code below, but its seems that the list style does not take any effect in the choices. It should prompt a numbered list but it prompts a button like list.
const{ChoicePrompt, ListStyle} = require('botbuilder-dialogs');
const CHOICE_PROMPT = 'CHOICE_PROMPT';
//Set up ChoicePrompt
var cp = new ChoicePrompt(CHOICE_PROMPT);
cp.Style = ListStyle.list;
this.addDialog(cp);
this.choicesX = ['Pick1', 'Pick2', 'Pick3'];
//function
async test(stepContext){
return await stepContext.prompt(CHOICE_PROMPT, {
prompt: 'Select item:',
choices: this.choicesX
});
}
在选择提示中添加列表样式的正确方法是什么?
What is the correct way to add a list style in the choices of choice prompt?
推荐答案
这似乎是此StackOverflow问题的重复;但是,答案是在C#中.这就是在Node SDK中设置样式提示选项的方式.
This seems to be a duplicate of this StackOverflow question; however, the answer is in C#. This is how you would set the style prompt option in the Node SDK.
Node SDK v4.5
const { ListStyle, ... } = require('botbuilder-dialogs');
async transportStep(step) {
// WaterfallStep always finishes with the end of the Waterfall or with another dialog; here it is a Prompt Dialog.
// Running a prompt here means the next WaterfallStep will be run when the users response is received.
return await step.prompt(CHOICE_PROMPT, {
prompt: 'Please enter your mode of transport.',
choices: ChoiceFactory.toChoices(['Car', 'Bus', 'Bicycle']),
style: ListStyle.list
});
}
列表样式选项为none
,auto
,inline
,list
,suggestedAction
和heroCard
.
The list style options are none
, auto
, inline
, list
, suggestedAction
, and heroCard
.
希望这会有所帮助!
这篇关于为botframework v4选择提示应用列表样式:NodeJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!