Skip to content

Commit

Permalink
fix(search): scroll to top on paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwoodland committed Jun 7, 2022
1 parent 4e49240 commit 3487b0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/ui/Scroll/Scroll.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template src="./Scroll.html" />
<template src="./Scroll.html"></template>

<script>
import Vue from 'vue'
Expand Down
1 change: 1 addition & 0 deletions components/views/chat/search/result/Result.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
@toggleOrder="toggleOrderBy"
/>
<UiScroll
ref="scrollRef"
verticalScroll
scrollbarVisibility="scroll"
class="search-result-content"
Expand Down
9 changes: 7 additions & 2 deletions components/views/chat/search/result/Result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,14 @@ export default Vue.extend({
})
this.isLoading = DataStateType.Ready
},
handleClickPaginate(pageNum: number) {
async handleClickPaginate(pageNum: number) {
this.page = pageNum
this.fetchResult()
await this.fetchResult()
if (!this.$refs.scrollRef) {
return
}
const scrollEl = this.$refs.scrollRef as Vue
scrollEl.$el.scrollTop = 0
},
onChange(value: any) {
this.queryOptions = {
Expand Down

0 comments on commit 3487b0f

Please sign in to comment.