开始使用
复制一个包含安装步骤和本插件完整 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.
targetLanguage":"Simplified Chinese"
protectedTokens":["Cloudflare","Capacitor","GitHub","Capgo","code","API","SDK","CLI","npm","bun"]You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsYou can use our AI-Assisted Setup to install the plugin. Add the __CAPGO_KEEP_0__ skills to your AI tool using the following command:":"使用我们的AI辅助安装程序安装插件。将以下命令添加到您的AI工具中:"
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-navigation-bar` plugin in my project.Copy to clipboard":"复制到剪贴板"
bun add @capgo/capacitor-navigation-barbunx cap syncIf you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:":"如果您prefer手动安装,请运行以下命令并遵循以下平台特定的说明:"
Terminal window":"终端窗口"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
标题为“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-导航栏 使用@capgo/capacitor-导航栏的原生功能 使用@capgo/capacitor-实时活动 使用@capgo/capacitor-实时活动的原生功能 @capgo/capacitor-实时活动 在@capgo/capacitor-实时活动中实现的细节 使用@capgo/capacitor-视频播放器 使用@capgo/capacitor-视频播放器的原生功能 @capgo/capacitor-视频播放器 在@capgo/capacitor-视频播放器中实现的细节