I'm building an application using Nuxt 3 and I want to add a page loader until the website loads.
P粉4366889312023-10-26 00:08:21
Based on this article. There is a simple but limited solution and a fully customized solution.
Contains a loading progress bar that can be used like this
1 2 3 4 5 6 |
|
But it only has a predefined UI and can only be customized using these attributes
If you need a custom loader (such as a full screen spinner with a background), a different approach is required. This approach allows you to create any loader and display it when needed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Nuxt3 provides application runtime hooks with interceptors for page:start
and page:finish
events. To use them correctly you need to use these hooks (in app.vue or your custom component) this way: