Nuxt3 中文课程 《实战全栈开发简书》.

<NuxtLoadingIndicator>

在页面导航之间显示一个进度条。

使用方法

在你的 app.vuelayouts/ 中添加 <NuxtLoadingIndicator/>

app.vue
<template>
  <NuxtLayout>
    <div>
      <NuxtLoadingIndicator /> <!-- 在这里 -->
      <NuxtPage />
    </div>
  </NuxtLayout>
</template>
Read and edit a live example in Docs > Examples > Routing > Pages.

插槽

你可以通过 loading indicator 的默认插槽传递自定义的 HTML 或组件。

属性

  • color: 进度条的颜色。可以设置为 false 来关闭显式的颜色样式。
  • height: 进度条的高度,以像素为单位(默认为 3)。
  • duration: 进度条的持续时间,以毫秒为单位(默认为 2000)。
  • throttle: 进度条出现和隐藏的节流时间,以毫秒为单位(默认为 200)。
这个组件是可选的。:br 为了实现完全定制,你可以基于其源代码实现自己的组件。