-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve&refactor: abstract the common chat module and improve scrollT…
…oBottom fn usage
- Loading branch information
Showing
5 changed files
with
65 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default class Chat { | ||
scrollToBottom(time = 0) { | ||
const ulDom = document.getElementsByClassName('chat-content-list')[0]; | ||
if (ulDom) { | ||
setTimeout(() => { | ||
ulDom.scrollTop = ulDom.scrollHeight + 10000; | ||
}, time); | ||
} | ||
} | ||
|
||
clearUnreadHandle({ homePageList, clearUnread, chatId }) { | ||
clearUnread({ homePageList, chatFromId: chatId }); | ||
} | ||
|
||
get isScrollInBottom() { | ||
const ulDom = document.getElementsByClassName('chat-content-list')[0]; | ||
if (ulDom) { | ||
return (ulDom.scrollTop + ulDom.clientHeight) === ulDom.scrollHeight; | ||
} | ||
return false; | ||
} | ||
} |