brutalism design
This commit is contained in:
@@ -15,9 +15,7 @@ export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeR
|
||||
end: false,
|
||||
})
|
||||
|
||||
watch(arrivedState, () => {
|
||||
console.log('arrived state', arrivedState)
|
||||
})
|
||||
let lastScrollHeight = 0
|
||||
|
||||
watch(el, (el) => {
|
||||
if (!el)
|
||||
@@ -31,14 +29,22 @@ export function useChatScroll(target: TemplateRef<HTMLElement>, options?: MaybeR
|
||||
if (arrivedState.start) {
|
||||
scrollToStart(true)
|
||||
}
|
||||
else {
|
||||
const heightDiff = el.value!.scrollHeight - lastScrollHeight
|
||||
|
||||
el.value!.scrollTop += heightDiff
|
||||
}
|
||||
|
||||
getArrivedState()
|
||||
|
||||
lastScrollHeight = el.value!.scrollHeight
|
||||
}, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
})
|
||||
|
||||
useEventListener(el, 'scroll', () => {
|
||||
console.log('scroll', el.value!.scrollTop)
|
||||
getArrivedState()
|
||||
}, { passive: true })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user