fix(client): Fix #6532
This commit is contained in:
		
							parent
							
								
									eb84445796
								
							
						
					
					
						commit
						5b5b64d251
					
				
					 2 changed files with 11 additions and 1 deletions
				
			
		|  | @ -30,6 +30,7 @@ import { faComments } from '@fortawesome/free-regular-svg-icons'; | |||
| import Progress from '../scripts/loading'; | ||||
| import XTimeline from '../components/timeline.vue'; | ||||
| import XPostForm from '../components/post-form.vue'; | ||||
| import { scroll } from '../scripts/scroll'; | ||||
| 
 | ||||
| export default Vue.extend({ | ||||
| 	metaInfo() { | ||||
|  | @ -120,7 +121,7 @@ export default Vue.extend({ | |||
| 		}, | ||||
| 
 | ||||
| 		top() { | ||||
| 			window.scroll({ top: 0, behavior: 'instant' }); | ||||
| 			scroll(this.$el, 0); | ||||
| 		}, | ||||
| 
 | ||||
| 		async choose(ev) { | ||||
|  |  | |||
|  | @ -25,3 +25,12 @@ export function onScrollTop(el: Element, cb) { | |||
| 	}; | ||||
| 	container.addEventListener('scroll', onScroll, { passive: true }); | ||||
| } | ||||
| 
 | ||||
| export function scroll(el: Element, top: number) { | ||||
| 	const container = getScrollContainer(el); | ||||
| 	if (container == null) { | ||||
| 		window.scroll({ top: top, behavior: 'instant' }); | ||||
| 	} else { | ||||
| 		container.scrollTop = top; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue