# @capacitor-community/native-market 中文文档

规范地址：https://npmcn.com/package/%40capacitor-community/native-market/

版本：8\.0\.0
npm 元数据更新时间：2026-10-23T21:47:59.712Z
中文译文更新时间：2026-11-09T03:33:44.778Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40capacitor-community/native-market
原文对照：https://npmcn.com/package/%40capacitor-community/native-market/?lang=original
项目主页：https://github.com/capacitor-community/native-market#readme
源码仓库：https://github.com/capacitor-community/native-market

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：31 kB，25 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：@capacitor/core \>=8\.0\.0
- 首次发布：2020-06-23T17:23:20.373Z
- 最新版本发布：2025-12-26T11:17:59.515Z
- 近 30 天下载量：46097（2026-10-09 至 2026-11-07，npm 官方下载统计）
- 已发布版本数：11（近 12 个月 1 个）

## 中文简介

连接到 google 播放或应用商店的本地市场插件 .

## 安装

```sh
npm install @capacitor-community/native-market
```

也可以使用：`pnpm add @capacitor-community/native-market`、`yarn add @capacitor-community/native-market`、`bun add @capacitor-community/native-market`

## README

# 本地市场插件

Play Store/App Store的本土市场Capacitor社区插件.

**说明:** 该插件在iOS模拟器上不起作用,因为它没有安装App Store应用. 它在Android虚拟设备上工作,如果他们安装了Google Play的用户登录.

维持状况:积极维持

## 插件版本

| 电容版本 | 插件版本 |
| --- | --- |
| 8.x 电话 | 8.x 电话 |
| 7.x 电话 | 7.x 电话 |
| 6.x (单位:千美元) | 6.x (单位:千美元) |
| 5.x 电话 | 5.x 电话 |
| 4.x (中文(简体) ) | 4.x (中文(简体) ) |
| < 3.x 键 | 0.1.x (中文(简体) ) |

## 安装

```bash
npm install @capacitor-community/native-market
npx cap sync
```

## 配置

此插件不需要配置

## 支持的方法

| 名称 | 机器人 | iOS系统 | 网页 |
| --- | --- | :-- | :-- |
| 打开站点列表 | ✅ | ✅ | ❌ |
| 打开DevPage | ✅ | ❌ | ❌ |
| 打开收集 | ✅ | ❌ | ❌ |
| 打开编辑器选择页 | ✅ | ❌ | ❌ |
| 搜索 | ✅ | ✅ | ❌ |

-   [`openStoreListing(...)`](https://npmcn.com/package/%40capacitor-community/native-market/#readme-openstorelisting)
-   [`openDevPage(...)`](https://npmcn.com/package/%40capacitor-community/native-market/#readme-opendevpage)
-   [`openCollection(...)`](https://npmcn.com/package/%40capacitor-community/native-market/#readme-opencollection)
-   [`openEditorChoicePage(...)`](https://npmcn.com/package/%40capacitor-community/native-market/#readme-openeditorchoicepage)
-   [`search(...)`](https://npmcn.com/package/%40capacitor-community/native-market/#readme-search)

## 示例

```typescript
import { NativeMarket } from "@capacitor-community/native-market";
import { Capacitor } from "@capacitor/core";

/**
 * This method will launch link in Play/App Store.
 * @param appId - ID of your application.
 * Eg:
 * io.ionic.ioniconf on Android
 * id1622127552 on iOS
 * @returns void
 */
let appId = "id1622127552";
if (Capacitor.getPlatform() === "android") {
  appId = "io.ionic.ioniconf";
}
NativeMarket.openStoreListing({
  appId: appId,
});

/**
 * This method will deep-link directly to an Play/App store listing page.
 * @param devId - ID of developer. Eg. com.example.app
 * @returns void
 */
NativeMarket.openDevPage({
  devId: "5700313618786177705",
});

/**
 * This method will link users to a collection or top charts.
 * @param name - name of the collection. Click [here](https://developer.android.com/distribute/marketing-tools/linking-to-google-play#OpeningCollection) for android options.
 * @returns void
 */
NativeMarket.openCollection({
  name: "featured",
});

/**
 * This method will link users to Editor's choice page.
 * @param editorChoice - ID of your application. Eg. editorial_fitness_apps_us
 * @returns void
 */
NativeMarket.openEditorChoicePage({
  editorChoice: "editorial_fitness_apps_us",
});

/**
 * This method will link users to custom search query.
 * @param editorChoice - terms to be searched in Play/App store.
 * @returns void
 */
NativeMarket.search({
  terms: "capacitor",
});
```

### 打开StoreListing(...)

```typescript
openStoreListing(options: { appId: string; }) => Promise<void>
```

| 参数 | 类型 |
| --- | --- |
| **`options`** | `{ appId: string; }` |

* * *

### 打开DevPage(...)

```typescript
openDevPage(options: { devId: string; }) => Promise<void>
```

| 参数 | 类型 |
| --- | --- |
| **`options`** | `{ devId: string; }` |

* * *

### 打开集合(...)

```typescript
openCollection(options: { name: string; }) => Promise<void>
```

| 参数 | 类型 |
| --- | --- |
| **`options`** | `{ name: string; }` |

* * *

### 打开编辑器选择页(...)

```typescript
openEditorChoicePage(options: { editorChoice: string; }) => Promise<void>
```

| 参数 | 类型 |
| --- | --- |
| **`options`** | `{ editorChoice: string; }` |

* * *

### 搜索(...)

```typescript
search(options: { terms: string; }) => Promise<void>
```

| 参数 | 类型 |
| --- | --- |
| **`options`** | `{ terms: string; }` |

* * *

## 常见问题

### @capacitor-community/native-market 是什么？

连接到 google 播放或应用商店的本地市场插件 \.

### 如何安装 @capacitor-community/native-market？

在项目目录运行 npm install @capacitor-community/native-market，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@capacitor/core（\>=8\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @capacitor-community/native-market 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @capacitor-community/native-market 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @capacitor-community/native-market 可以商用吗？

@capacitor-community/native-market 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @capacitor-community/native-market 的下载量有多少？

根据 npm 官方下载统计，@capacitor-community/native-market 在 2026/10/09 – 2026/11/07 这 30 天内被下载 46,097 次，日均约 1,537 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @capacitor-community/native-market 还在维护吗？

最新版本 8\.0\.0 发布于 2025/12/26（10 个月前）；至今共发布 11 个版本，其中过去 12 个月发布了 1 个；首次发布于 2020/06/24。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

