Getting Started
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-navigation-bar`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/navigation-bar/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
安装bun add @capgo/capacitor-navigation-barbunx cap sync导入
导入import { NavigationBar } from '@capgo/capacitor-navigation-bar';API 概述
API 概述setNavigationBarColor
设置导航栏颜色和按钮主题setNavigationBarColor
import { NavigationBar } from '@capgo/capacitor-navigation-bar';
// Set to white with dark buttonsawait NavigationBar.setNavigationBarColor({ color: NavigationBarColor.WHITE, darkButtons: true});
// Set to custom colorawait NavigationBar.setNavigationBarColor({ color: '#FF5733', darkButtons: false});
// Set a custom divider color on Android 9+await NavigationBar.setNavigationBarColor({ color: NavigationBarColor.WHITE, darkButtons: true, dividerColor: '#D9D9D9'});getNavigationBarColor
标题:获取导航栏颜色获取当前导航栏颜色和按钮主题
import { NavigationBar } from '@capgo/capacitor-navigation-bar';
const { color, darkButtons } = await NavigationBar.getNavigationBarColor();console.log('Current color:', color);console.log('Using dark buttons:', darkButtons);类型参考
标题:类型参考NavigationBarColor
标题:导航栏颜色预定义导航栏颜色
export enum NavigationBarColor { /** White color */ WHITE = '#FFFFFF', /** Black color */ BLACK = '#000000', /** Transparent color */ TRANSPARENT = 'transparent',}真实来源
标题:真实来源本页面由插件生成 src/definitions.ts. 当 API 上游发生变化时,请重新运行同步。
继续 Getting Started
标题:继续 Getting Started如果您正在使用 Getting Started 来规划原生媒体和界面行为,请将其与 使用 @capgo/capacitor-navigation-bar 在使用 @capgo/capacitor-navigation-bar 中的原生能力 使用 @capgo/capacitor-live-activities 在使用 @capgo/capacitor-live-activities 中的原生能力 @capgo/capacitor-live-activities 在 @capgo/capacitor-live-activities 中的实现细节 使用 @capgo/capacitor-视频播放器 为 @capgo/capacitor-视频播放器 的原生能力 在 @capgo/capacitor-视频播放器 中 查看 @capgo/capacitor-视频播放器 的实现细节