良い感じに
This commit is contained in:
		
							parent
							
								
									2a7d4ee866
								
							
						
					
					
						commit
						3f749c6540
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -62,11 +62,16 @@ export const router = new VueRouter({ | |||
| 	], | ||||
| 	// なんかHacky
 | ||||
| 	// 通常の使い方をすると scroll メソッドの behavior を設定できないため、自前で window.scroll するようにする
 | ||||
| 	// setTimeout しないと、アニメーション(トランジション)の関係でうまく動かない
 | ||||
| 	scrollBehavior(to) { | ||||
| 		window._scroll = () => { // さらにHacky
 | ||||
| 			if (to.name === 'index') { | ||||
| 				window.scroll({ top: indexScrollPos, behavior: 'instant' }); | ||||
| 				const i = setInterval(() => { | ||||
| 					window.scroll({ top: indexScrollPos, behavior: 'instant' }); | ||||
| 				}, 10); | ||||
| 				setTimeout(() => { | ||||
| 					clearInterval(i); | ||||
| 				}, 500); | ||||
| 			} else { | ||||
| 				window.scroll({ top: 0, behavior: 'instant' }); | ||||
| 			} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue