|
1 | 1 | <template> |
2 | | - <div |
3 | | - class="messages-container" |
4 | | - ref="messageContainer" |
5 | | - :class="{ 'is-dark': isDark }" |
6 | | - :tabindex="manualWheelScroll ? -1 : null" |
7 | | - @wheel="handleWheelScroll"> |
| 2 | + <div class="messages-container" ref="messageContainer" :class="{ 'is-dark': isDark }"> |
8 | 3 | <!-- 加载指示器 --> |
9 | 4 | <div v-if="isLoadingMessages" class="loading-overlay" :class="{ 'is-dark': isDark }"> |
10 | 5 | <v-progress-circular indeterminate size="48" width="4" color="primary"></v-progress-circular> |
@@ -229,10 +224,6 @@ export default { |
229 | 224 | isLoadingMessages: { |
230 | 225 | type: Boolean, |
231 | 226 | default: false |
232 | | - }, |
233 | | - manualWheelScroll: { |
234 | | - type: Boolean, |
235 | | - default: false |
236 | 227 | } |
237 | 228 | }, |
238 | 229 | emits: ['openImagePreview', 'replyMessage', 'replyWithText', 'openRefs'], |
@@ -767,34 +758,6 @@ export default { |
767 | 758 | this.isUserNearBottom = distanceFromBottom <= this.scrollThreshold; |
768 | 759 | } |
769 | 760 | }, |
770 | | -
|
771 | | - handleWheelScroll(event) { |
772 | | - if (!this.manualWheelScroll || event.ctrlKey) { |
773 | | - return; |
774 | | - } |
775 | | -
|
776 | | - const container = this.$refs.messageContainer; |
777 | | - if (!container) { |
778 | | - return; |
779 | | - } |
780 | | -
|
781 | | - if (document.activeElement !== container) { |
782 | | - container.focus({ preventScroll: true }); |
783 | | - } |
784 | | -
|
785 | | - const deltaMultiplier = event.deltaMode === 1 |
786 | | - ? 16 |
787 | | - : event.deltaMode === 2 |
788 | | - ? container.clientHeight |
789 | | - : 1; |
790 | | -
|
791 | | - container.scrollTop += event.deltaY * deltaMultiplier; |
792 | | -
|
793 | | - event.preventDefault(); |
794 | | - event.stopPropagation(); |
795 | | - this.handleScroll(); |
796 | | - }, |
797 | | -
|
798 | 761 | // 组件销毁时移除监听器 |
799 | 762 | beforeUnmount() { |
800 | 763 | const container = this.$refs.messageContainer; |
|
0 commit comments