Skip to content

Commit

Permalink
初回チャンネル表示時にスクロール位置が上になっていることがあった (再)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Mar 17, 2022
1 parent ab296b7 commit a4322bd
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,20 @@ const messageComponent = computed(() =>
)
onMounted(() => {
state.height = rootRef.value?.scrollHeight ?? 0
// 表示されている
if (stampsMapFetched.value) {
state.height = rootRef.value?.scrollHeight ?? 0
}
})
// マウント後にstampの取得が完了した場合
watch(stampsMapFetched, async fetched => {
if (fetched && rootRef.value) {
await nextTick()
const scrollHeight = rootRef.value.scrollHeight
rootRef.value.scrollTop = scrollHeight
state.height = scrollHeight
state.scrollTop = scrollHeight
}
})
watch(
Expand Down

0 comments on commit a4322bd

Please sign in to comment.