| | |
| | | |
| | | const scrollToBottom = () => { |
| | | nextTick(() => { |
| | | if (!chatListDom.value) return; |
| | | const parent = chatListDom.value.parentElement; |
| | | if (!parent) return; |
| | | if (parent.scrollHeight > parent.clientHeight) { |
| | | parent.scrollTop = parent.scrollHeight - parent.clientHeight; |
| | | if (chatListDom.value.scrollHeight > chatListDom.value.clientHeight) { |
| | | chatListDom.value.scrollTop = chatListDom.value.scrollHeight - chatListDom.value.clientHeight; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const scrollToTop = () => { |
| | | nextTick(() => { |
| | | chatListDom.value.scrollTop = 0; |
| | | }); |
| | | }; |
| | | const debounceAmisScroll = debounce(({ instance }) => { |
| | |
| | | |
| | | return { |
| | | scrollToBottom, |
| | | scrollToTop, |
| | | }; |
| | | }; |