From 57e8c9c7cd27e81aa295b2fb10bcf720b30afad0 Mon Sep 17 00:00:00 2001 From: Pang Date: Sat, 13 Jan 2024 22:26:48 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/manage/components/DialogWrapper.vue | 28 ++++----- .../sass/pages/components/dialog-wrapper.scss | 61 ++++++++++--------- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 173790080..920c285f4 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -200,10 +200,12 @@ @on-emoji="onEmoji" @on-show-emoji-user="onShowEmojiUser"> @@ -2131,17 +2133,19 @@ export default { requestAnimationFrame(_ => this.msgActiveId = id) }, - onToOffset(offset) { + onToOffset(offset, forceFront = false) { const scroller = this.$refs.scroller; if (scroller) { const front = scroller.getOffset() > offset scroller.stopToBottom(); scroller.scrollToOffset(offset); - if (front) { - scroller.virtual.handleFront() - } else { - scroller.virtual.handleBehind() - } + setTimeout(_ => { + if (front || forceFront) { + scroller.virtual.handleFront() + } else { + scroller.virtual.handleBehind() + } + }, 10) } }, @@ -2218,11 +2222,7 @@ export default { const previousSize = typeof previousValue === "object" ? previousValue.size : scroller.getSize(previousValue) return {size: previousSize + scroller.getSize(currentId)} }) - let offset = scroller.getOffset() + reducer.size - if (this.prevId === 0) { - offset -= 36 - } - this.onToOffset(offset) + this.onToOffset(scroller.getOffset() + reducer.size, true) }); }).catch(() => {}) }, diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss index 68c3f831e..c28f871c7 100644 --- a/resources/assets/sass/pages/components/dialog-wrapper.scss +++ b/resources/assets/sass/pages/components/dialog-wrapper.scss @@ -1411,6 +1411,37 @@ } + &.head-box { + height: 36px; + align-items: center; + justify-content: center; + + .loading { + > span { + width: 8px; + height: 8px; + border-radius: 50%; + display: block; + margin: 0 auto; + position: relative; + background: #e3e3e3; + box-sizing: border-box; + animation: head-box-loading-animation 0.5s linear infinite alternate; + } + } + + .describe { + color: $primary-desc-color; + } + + .filled { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + } + &.unread-start { position: relative; padding-top: 44px; @@ -1436,22 +1467,6 @@ } } - &.loading { - height: 20px; - box-sizing: content-box; - align-items: center; - justify-content: center; - } - - &.nothing { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - color: $primary-desc-color; - padding: 0; - } - &.self { flex-direction: row-reverse; @@ -2116,19 +2131,7 @@ body:not(.window-touch) { overflow: hidden !important; } -.dialog-wrapper-loading { - width: 8px; - height: 8px; - border-radius: 50%; - display: block; - margin: 0 auto; - position: relative; - background: #e3e3e3; - box-sizing: border-box; - animation: dialog-loading-animation 0.5s linear infinite alternate; -} - -@keyframes dialog-loading-animation { +@keyframes head-box-loading-animation { 0% { box-shadow: 0 0, 0 0; color: rgba(#e3e3e3, 0.2);