refactor: create plugin to track whether the page is fully loaded or not
This commit is contained in:
		
							parent
							
								
									1b75c199a4
								
							
						
					
					
						commit
						e3d645c4dc
					
				
							
								
								
									
										16
									
								
								plugins/80.finish.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								plugins/80.finish.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | export default defineNuxtPlugin({ | ||||||
|  | 	name: "set finish", | ||||||
|  | 	setup(nuxt) { | ||||||
|  | 		console.log("setup start"); | ||||||
|  | 		let loaded: Ref<boolean> = ref(false); | ||||||
|  | 		nuxt.hook("page:finish", (comp) => { | ||||||
|  | 			console.log("setup end"); | ||||||
|  | 			loaded.value = true; | ||||||
|  | 		}); | ||||||
|  | 		return { | ||||||
|  | 			provide: { | ||||||
|  | 				loaded, | ||||||
|  | 			}, | ||||||
|  | 		}; | ||||||
|  | 	}, | ||||||
|  | }); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user