mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
优化消息弹窗的滚动逻辑
This commit is contained in:
@@ -111,6 +111,10 @@ async function openMessageDialog() {
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await clearAppBadge()
|
await clearAppBadge()
|
||||||
}, 500)
|
}, 500)
|
||||||
|
// 延迟滚动到底部,确保弹窗完全打开
|
||||||
|
setTimeout(() => {
|
||||||
|
forceScrollToEnd()
|
||||||
|
}, 600)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 智能滚动到底部(只有用户在底部附近时才滚动)
|
// 智能滚动到底部(只有用户在底部附近时才滚动)
|
||||||
@@ -118,6 +122,7 @@ function scrollMessageToEnd() {
|
|||||||
// 使用更长的延迟确保DOM已更新
|
// 使用更长的延迟确保DOM已更新
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
|
// 查找消息弹窗的滚动容器
|
||||||
const cardText = document.querySelector('.v-dialog .v-card-text')
|
const cardText = document.querySelector('.v-dialog .v-card-text')
|
||||||
if (cardText) {
|
if (cardText) {
|
||||||
const { scrollTop, scrollHeight, clientHeight } = cardText
|
const { scrollTop, scrollHeight, clientHeight } = cardText
|
||||||
@@ -138,6 +143,7 @@ function scrollMessageToEnd() {
|
|||||||
function forceScrollToEnd() {
|
function forceScrollToEnd() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
|
// 查找消息弹窗的滚动容器
|
||||||
const cardText = document.querySelector('.v-dialog .v-card-text')
|
const cardText = document.querySelector('.v-dialog .v-card-text')
|
||||||
if (cardText) {
|
if (cardText) {
|
||||||
cardText.scrollTop = cardText.scrollHeight
|
cardText.scrollTop = cardText.scrollHeight
|
||||||
@@ -179,7 +185,6 @@ defineExpose({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
forceScrollToEnd() // 初始化时强制滚动到底部
|
|
||||||
const shortcut = getQueryValue('shortcut')
|
const shortcut = getQueryValue('shortcut')
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
const found = shortcuts.find(item => item.dialog === shortcut)
|
const found = shortcuts.find(item => item.dialog === shortcut)
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ async function loadMessages({ done }: { done: any }) {
|
|||||||
|
|
||||||
// 合并数据
|
// 合并数据
|
||||||
messages.value = [...currData.value, ...messages.value]
|
messages.value = [...currData.value, ...messages.value]
|
||||||
|
// 首次加载时滚动到底部
|
||||||
if (page.value === 1) {
|
if (page.value === 1) {
|
||||||
// 首次加载时滚动到底部
|
|
||||||
emit('scroll')
|
emit('scroll')
|
||||||
}
|
}
|
||||||
// 页码+1
|
// 页码+1
|
||||||
|
|||||||
Reference in New Issue
Block a user