mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 08:06:43 +08:00
feat: 添加新会话时自动滚动到顶部,优化空态展示
This commit is contained in:
@@ -348,6 +348,20 @@ function scrollToBottom() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新会话展示空态时必须回到顶部,避免复用上一段长会话的滚动位置导致空白。
|
||||||
|
function scrollToTop() {
|
||||||
|
nextTick(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
const scroller = getMessageScrollerElement()
|
||||||
|
if (!scroller) return
|
||||||
|
|
||||||
|
messageListRef.value?.ps?.update()
|
||||||
|
scroller.scrollTop = 0
|
||||||
|
messageListRef.value?.ps?.update()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function syncInputHeight() {
|
function syncInputHeight() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const input = inputRef.value
|
const input = inputRef.value
|
||||||
@@ -762,6 +776,7 @@ function startNewSession() {
|
|||||||
historyMenuOpen.value = false
|
historyMenuOpen.value = false
|
||||||
clearPendingAttachments()
|
clearPendingAttachments()
|
||||||
persistState()
|
persistState()
|
||||||
|
scrollToTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从历史列表恢复指定会话,同时把它设为当前本地会话。
|
// 从历史列表恢复指定会话,同时把它设为当前本地会话。
|
||||||
@@ -1418,18 +1433,18 @@ onScopeDispose(() => {
|
|||||||
min-block-size: 0;
|
min-block-size: 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
padding-block: 1rem calc(env(safe-area-inset-bottom, 0px) + 12rem);
|
padding-block: 1rem calc(env(safe-area-inset-bottom, 0px) + 6rem);
|
||||||
padding-inline: 1rem;
|
padding-inline: 1rem;
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
}
|
}
|
||||||
|
|
||||||
.agent-assistant-empty {
|
.agent-assistant-empty {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-sizing: border-box;
|
|
||||||
color: rgba(var(--v-theme-on-surface), 0.7);
|
color: rgba(var(--v-theme-on-surface), 0.7);
|
||||||
min-block-size: 0;
|
min-block-size: 0;
|
||||||
padding-block: 2rem 1.25rem;
|
padding-block: 2rem 1.25rem;
|
||||||
@@ -1441,13 +1456,7 @@ onScopeDispose(() => {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border: 1px solid rgba(var(--v-theme-primary), 0.18);
|
|
||||||
border-radius: 8px;
|
|
||||||
background: rgba(var(--v-theme-primary), 0.1);
|
|
||||||
block-size: 3.75rem;
|
|
||||||
box-shadow: inset 0 1px 0 rgba(var(--v-theme-on-primary), 0.1);
|
|
||||||
color: rgb(var(--v-theme-primary));
|
color: rgb(var(--v-theme-primary));
|
||||||
inline-size: 3.75rem;
|
|
||||||
margin-block-end: 1rem;
|
margin-block-end: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1828,9 +1837,9 @@ onScopeDispose(() => {
|
|||||||
:deep(h1),
|
:deep(h1),
|
||||||
:deep(h2),
|
:deep(h2),
|
||||||
:deep(h3) {
|
:deep(h3) {
|
||||||
margin-block: 0.5rem;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
|
margin-block: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(h1) {
|
:deep(h1) {
|
||||||
@@ -1909,11 +1918,11 @@ onScopeDispose(() => {
|
|||||||
|
|
||||||
:deep(table) {
|
:deep(table) {
|
||||||
display: block;
|
display: block;
|
||||||
overflow-x: auto;
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
inline-size: max-content;
|
inline-size: max-content;
|
||||||
max-inline-size: 100%;
|
|
||||||
margin-block: 0.5rem;
|
margin-block: 0.5rem;
|
||||||
|
max-inline-size: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(th),
|
:deep(th),
|
||||||
|
|||||||
Reference in New Issue
Block a user