如何在 BotFramework 中设置菜单按钮的样式?
How to style the menu button in BotFramework?
我正在尝试完全按照 this page 中所示添加菜单按钮,
(来源:botframework.com)
我试过如下使用 HeroCard
var msg = new builder.Message(session)
.textFormat(builder.TextFormat.xml)
.attachments([
new builder.HeroCard(session)
.title("Main Menu")
.subtitle("How can we assist you today?")
.text("Please click on a button.")
.buttons([
builder.CardAction.dialogAction(session,"flight",'','Book a Flight'),
builder.CardAction.dialogAction(session,"hotel",'','Book a Hotel'),
builder.CardAction.dialogAction(session,"car",'','Book a Car')
])
]);
我知道上面的内容还不够,我想弄清楚需要做什么才能让按钮像在 BOT 框架概述页面中那样很好地显示。
以上代码的显示方式如下。
如有任何帮助,我们将不胜感激! :)
按钮的呈现方式取决于您使用机器人的渠道。您无法更改按钮样式,但 WebChat channel, that is open source and you might be able to tweak the stylesheets.
除外
在您的图片中,您正在使用模拟器,这就是按钮的样子。
查看 Channel Inspector 以了解每个通道将如何呈现每个支持的功能。
我正在尝试完全按照 this page 中所示添加菜单按钮,
(来源:botframework.com)
我试过如下使用 HeroCard
var msg = new builder.Message(session)
.textFormat(builder.TextFormat.xml)
.attachments([
new builder.HeroCard(session)
.title("Main Menu")
.subtitle("How can we assist you today?")
.text("Please click on a button.")
.buttons([
builder.CardAction.dialogAction(session,"flight",'','Book a Flight'),
builder.CardAction.dialogAction(session,"hotel",'','Book a Hotel'),
builder.CardAction.dialogAction(session,"car",'','Book a Car')
])
]);
我知道上面的内容还不够,我想弄清楚需要做什么才能让按钮像在 BOT 框架概述页面中那样很好地显示。
以上代码的显示方式如下。
如有任何帮助,我们将不胜感激! :)
按钮的呈现方式取决于您使用机器人的渠道。您无法更改按钮样式,但 WebChat channel, that is open source and you might be able to tweak the stylesheets.
除外在您的图片中,您正在使用模拟器,这就是按钮的样子。
查看 Channel Inspector 以了解每个通道将如何呈现每个支持的功能。