Skip to content

Commit

Permalink
修复点击切换显示模式会滚动到底部的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
keysking committed Apr 22, 2023
1 parent bb29dbd commit a7ef9f5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/RecordPanel/RecordPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { x, y, isScrolling, arrivedState, directions } = useScroll(rootEl, {
behavior: "smooth",
});
async function scrollToBottom() {
console.log(56);
rootEl.value.scrollTop = rootEl.value.scrollHeight + 2000;
}
Expand All @@ -28,6 +29,7 @@ async function toggoleRecordDisplay(record) {
watch(
[records, refThrottled(readingRecord, 150)],
() => {
console.log(12);
if (pinBottom.value) {
setTimeout(() => scrollToBottom(), 0);
}
Expand All @@ -42,11 +44,7 @@ watch(
class="overflow-y-auto scroll-smooth p-2 relative record-panel pb-10"
>
<template v-for="record in records" :key="record.time">
<div
v-if="record.type == 'read'"
class="chat chat-start"
@click="scrollToBottom"
>
<div v-if="record.type == 'read'" class="chat chat-start">
<div class="chat-header mx-2 flex">
<!-- TODO 点击可以切换时间显示格式(是否显示日期) -->
<div class="text-sm opacity-70">
Expand Down

0 comments on commit a7ef9f5

Please sign in to comment.