Comments (8)
我也遇到类似的问题 不过我的是表情组件第一次渲染之后可以弹出来 第二次点击就弹不出来了
from chatui.
有 demo 吗?
from chatui.
有 demo 吗?
var bot = new ChatSDK({
config: {
navbar: {
title: '智能助理'
},
robot: {
avatar: '//gw.alicdn.com/tfs/TB1U7FBiAT2gK0jSZPcXXcKkpXa-108-108.jpg'
},
toolbar: [
{
type: 'image',
icon: 'image',
title: '相册',
},
{
type: 'emoji',
icon: 'smile',
title: '表情',
render:
<Picker
style={{ width: '100%' }}
key={Math.random()*100}
/>
},
],
messages: [
{
type: 'text',
content: {
text: '智能助理为您服务,请问有什么可以帮您?'
}
}
]
},
requests: {
send: function (msg) {
if (msg.type === 'text') {
return {
url: '//api.server.com/ask',
data: {
q: msg.content.text
}
};
}
}
}
});
bot.run();
在render表情的时候 只加载了一次
from chatui.
在render表情的时候 只加载了一次
能放到类似 https://codesandbox.io/ 的地方看效果吗
from chatui.
其实问题出在useClickOutside这个方法,当点击 Toolbar 的时候,Toolbar的click事件还在处理时(未冒泡到body)就添加了一个事件到body(调用栈在popover最开始),toolbar的click处理完后继续进行事件冒泡,冒泡到了body就触发刚才添加的click事件(即隐藏popover的处理)。
解决方案有两个,停止冒泡(但显然不合理,popover可能在别的地方也会用)。useClickOutside 添加事件时用set time out包裹,等 click 事件结束并进入下一个 eventloop 再添加事件。
from chatui.
至于第一次为什么可以,估计是Popover还没被初始化,也对dom进行了一次处理使浏览器进入了重排,事件冒泡也停了?具体原因需要看composer的代码。
from chatui.
我们的小蜜项目是没有这个问题的,我在研究一下吧有什么差异,可以临时用下面的代码解决,Pro 的话升级到 v0.2.2 :
onToolbarClick={(item, e) => {
// handleToolbarClick(item);
e.stopPropagation();
}}
from chatui.
v0.3.3 已修复
from chatui.
Related Issues (20)
- react hooks项目里可以使用语音输入吗?
- 由于项目框架老旧,使用hooks写法打包报错。 HOT 2
- 小程序开发如何使用 HOT 1
- 样式污染全局怎么解决 HOT 1
- renderMessageContent为空函数的情况下,message对象中的{user: {avatar: '', name: ''} 头像和用户名依然会被渲染
- 如何禁用 Input Box
- BUG:<chat/>组件使用composer渲染自定义组件<inputarea/>之后,每次发送完消息,我自己定义的<inputarea/>就会强制刷新 HOT 2
- 如果做打字机效果回复的 时候 HOT 3
- rightAction
- 发送消息后滚动条没有滚到最下面还有一些像素,这个怎么解决? HOT 2
- 等待回复过程中禁用输入 HOT 1
- _id动态设置不成功 HOT 1
- 头像图片资源重复调用
- 国际化不生效 HOT 1
- Chat UI Pro 查看历史消息的URL没有自动填充分页参数currentPage,pageSize HOT 1
- 点赞点踩功能可以无限次点击 HOT 1
- SSE流式响应处理 HOT 5
- 请问有没有权限认证
- icon图标用不了
- 如何设置messagecontainer的高度
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatui.