Skip to content

Commit

Permalink
refactor: fixed the problem that the scroll component could not remem…
Browse files Browse the repository at this point in the history
…ber the height
  • Loading branch information
zyronon committed May 3, 2024
1 parent d2b532a commit eff3277
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/utils/hooks/useBase.ts

This file was deleted.

17 changes: 17 additions & 0 deletions src/utils/hooks/useScroll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { onActivated, onDeactivated, ref } from 'vue'

export function useScroll() {
const mainScroll = ref()
let mainScrollTop = $ref(0)
onActivated(() => {
if (mainScroll.value && mainScroll.value.wrapper) {
mainScroll.value.wrapper.scrollTop = mainScrollTop
}
})
onDeactivated(() => {
if (mainScroll.value && mainScroll.value.wrapper) {
mainScrollTop = mainScroll.value.wrapper.scrollTop
}
})
return mainScroll
}

0 comments on commit eff3277

Please sign in to comment.