-
|
I can only see |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Hey, It's been a long time but you can suscribe to the router events by doing this after initializing the router instance! // Set up a Router instance
const router = createRouter({
routeTree,
// ... Your router props
});
// Subscribe to events
router.subscribe('onBeforeLoad', () => nprogress.start())
router.subscribe('onLoad', () => nprogress.complete())More information about router events here Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
|
Only the path changed should display loading. |
Beta Was this translation helpful? Give feedback.
-
|
I’m expanding on this to share a complete step-by-step guide for anyone who isn’t sure how to set things up properly. This includes making sure the progress bar only finishes after the router is fully resolved with data. Install BProgress pnpm add @bprogress/coreImport the CSS in your styles.css @import '@bprogress/core/css';Optional: Change the color :root {
--bprogress-color: var(--primary);
}Add the events in router.tsx // Progress bar configuration
// BProgress.configure({
// showSpinner: false
// })
// Progress bar Start
router.subscribe('onBeforeNavigate', ({ pathChanged }) => {
pathChanged && BProgress.start()
})
// Progress bar Done
router.subscribe('onResolved', () => {
BProgress.done()
})
return router |
Beta Was this translation helpful? Give feedback.
Only the path changed should display loading.