622ed075f588167a40fb90c65a224015.gif

622ed075f588167a40fb90c65a224015.gif

BotUI的对话设定是比较简单的,下面有一个例子,可以参考这个官方的 DEMO 来设置。

HTML 代码:

JS 设置:

var botui = new BotUI('botui-app'); // give it the id of container

botui.message.bot({ // show first message

delay: 200,

content: 'hello'

}).then(function () {

return botui.message.bot({ // second one

delay: 1000, // wait 1 sec.

content: 'how are you?'

});

}).then(function () {

return botui.action.button({ // let user do something

delay: 1000,

action: [

{

text: 'Good',

value: 'good'

},

{

text: 'Really Good',

value: 'really_good'

}

]

});

}).then(function (res) {

return botui.message.bot({

delay: 1000,

content: 'You are feeling ' + res.text + '!'

});

});

推荐:查看最受欢迎的 301 个设计网站 → http://hao.shejidaren.com

交流:为设计新人提供的设计交流群,请加入UI设计交流群,分享经验、接单、求职、聊设计。

赞助商链接

155252a6671cbe350ec7f31b0924d3ce.png

赞助商链接

喜欢这篇文章吗?欢迎分享到你的微博、QQ群,并关注我们的微博,谢谢支持。

版权:除非注明,本站文章均为原创文章,转载请联系我们授权,否则禁止转载。

{ 发表评论 }

姓 名 (必填)

邮 件 (必填)

网 站

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐