优化聊天
This commit is contained in:
parent
a4589d9f6f
commit
8e65fdf520
|
|
@ -37,12 +37,6 @@ const ChatBigWindow: React.FC = () => {
|
|||
}
|
||||
window.electron.windowHandleMessageCallBack((_e: any, data: any) => {
|
||||
setChatLists(data.parmes.chatList)
|
||||
setTimeout(() => {
|
||||
const chatBigWindowView = document.getElementById('chatBigWindowView') as HTMLElement;
|
||||
if (chatBigWindowView) {
|
||||
chatBigWindowView.scrollTop = chatBigWindowView.scrollHeight;
|
||||
}
|
||||
}, 100)
|
||||
})
|
||||
channel.postMessage({
|
||||
type: 'chatBigWindowSendChannelMsg',
|
||||
|
|
@ -54,6 +48,12 @@ const ChatBigWindow: React.FC = () => {
|
|||
channel.close();
|
||||
}
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const chatBigWindowView = document.getElementById('chatBigWindowView') as HTMLElement;
|
||||
if (chatBigWindowView) {
|
||||
chatBigWindowView.scrollTop = chatBigWindowView.scrollHeight;
|
||||
}
|
||||
}, [chatLists]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@ const ChatSmallWindow: React.FC = () => {
|
|||
}, 10000);
|
||||
return [data.parmes.chatListIten, ...newChatList]
|
||||
})
|
||||
setTimeout(() => {
|
||||
const chatSmallWindowView = document.getElementById('chatSmallWindowView') as HTMLElement;
|
||||
if (chatSmallWindowView) {
|
||||
chatSmallWindowView.scrollTop = chatSmallWindowView.scrollHeight;
|
||||
}
|
||||
}, 100)
|
||||
})
|
||||
return () => {
|
||||
channel.close();
|
||||
}
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const chatBigWindowView = document.getElementById('chatBigWindowView') as HTMLElement;
|
||||
if (chatBigWindowView) {
|
||||
chatBigWindowView.scrollTop = chatBigWindowView.scrollHeight;
|
||||
}
|
||||
}, [chatLists]);
|
||||
const removeItemByIndex = () => {
|
||||
setChatLists((res: any) => {
|
||||
return res.slice(0, -1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue