From c95a48c63287aa7295edb36f4ff21e262ba12ecd Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 8 Jul 2022 01:59:55 +0800 Subject: [PATCH] feat(nuxt): add `` component (#5121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian <48835293+DamianGlowala@users.noreply.github.com> Co-authored-by: Sébastien Chopin Co-authored-by: Pooya Parsa --- .../2.components/4.nuxt-loading-indicator.md | 34 +++++ examples/routing/pages/app.vue | 1 + .../app/components/nuxt-loading-indicator.ts | 120 ++++++++++++++++++ packages/nuxt/src/core/nuxt.ts | 6 + 4 files changed, 161 insertions(+) create mode 100644 docs/content/3.api/2.components/4.nuxt-loading-indicator.md create mode 100644 packages/nuxt/src/app/components/nuxt-loading-indicator.ts diff --git a/docs/content/3.api/2.components/4.nuxt-loading-indicator.md b/docs/content/3.api/2.components/4.nuxt-loading-indicator.md new file mode 100644 index 0000000000..8989315c70 --- /dev/null +++ b/docs/content/3.api/2.components/4.nuxt-loading-indicator.md @@ -0,0 +1,34 @@ +# `` + +::ReadMore{link="/guide/features/routing"} +:: + +Nuxt provides `` to display a progress bar on page navigation. + +## Examples + +### Basic usage + +Add `` in your `app.vue` or layouts. + +```vue [app.vue] + +``` + +:button-link[Open on StackBlitz]{href="https://stackblitz.com/github/nuxt/framework/tree/main/examples/routing/pages?terminal=dev&file=/app.vue" blank} + +## Props + +- **color**: The color of the loading bar. +- **height**: Height of the loading bar, in pixels (default `3`). +- **duration**: Duration of the loading bar, in milliseconds (default `2000`). +- **throttle**: Throttle the appearing and hiding, in milliseconds (default `200`). + +::alert{type=info icon=🔎} +This component is completely optional. To achieve full customization, you can implement your own one based on [this file](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/components/nuxt-loading-bar.ts). +:: diff --git a/examples/routing/pages/app.vue b/examples/routing/pages/app.vue index 9f44a00aaa..8ffd82ba5d 100644 --- a/examples/routing/pages/app.vue +++ b/examples/routing/pages/app.vue @@ -4,6 +4,7 @@ const route = useRoute()