# @gondel/core 中文文档

规范地址：https://npmcn.com/package/%40gondel/core/

版本：1\.2\.10
npm 元数据更新时间：2026-10-29T14:23:27.342Z
中文译文更新时间：2026-11-16T18:56:41.274Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40gondel/core
原文对照：https://npmcn.com/package/%40gondel/core/?lang=original
项目主页：https://github.com/merkle-open/gondel
源码仓库：https://github.com/merkle-open/gondel

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

- 包体积（解压后）：226 kB，37 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2018-05-09T15:14:24.108Z
- 最新版本发布：2026-10-29T14:23:26.752Z
- 近 30 天下载量：3488（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：21（近 12 个月 1 个）

## 中文简介

Gondel 库的基础核心

## 安装

```sh
npm install @gondel/core
```

也可以使用：`pnpm add @gondel/core`、`yarn add @gondel/core`、`bun add @gondel/core`

## README

[![NPM version](https://badge.fury.io/js/%40gondel%2Fcore.svg)](https://npmjs.org/package/@gondel/core) [![Build Status](https://github.com/merkle-open/gondel/workflows/ci/badge.svg?branch=master)](https://github.com/merkle-open/gondel/actions) [![Size](http://img.badgesize.io/merkle-open/gondel/master/packages/core/dist/gondel.es5.min.js.svg?compression=gzip&label=gzip%20size)](https://unpkg.com/@gondel/core/dist/gondel.es5.min.js) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Prettier](https://img.shields.io/badge/Code%20Style-Prettier-green.svg)](https://github.com/prettier/prettier)

# 贡德尔

[贡德尔](https://en.wikipedia.org/wiki/Gondola) 是一个微小的(3kb)非侵入性库来帮助您模块化您的代码 .  
没错 **没有** 具有渲染引擎的飞船是最适合大多数客户端侧渲染引擎(如React或Angular)和服务器侧渲染引擎(如Java或PHP)的

## 安装

```bash
npm i @gondel/core
```

## 哈罗世界

此按钮将全部监听 `click events` 来自所有元素的事件 `data-g-name="Button"` 并将 显示提醒消息.

HTML 语言

```html
 <button data-g-name="Button">Click me</button>

 <button data-g-name="Button">Or click me</button>
```

联合来文

```js
import {Component, EventListener, GondelBaseComponent} from '@gondel/core';

// The @Component decorator will connect the class with `data-g-name="Button"` elements.
@Component('Button')
export class Button extends GondelBaseComponent {
  @EventListener('click') 
  _handleChange(event) {
    alert('Hello World')
  }
}
```

[哈罗世界实例](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/hello-world)

## 模块格式

刚德尔跟随 [滚动建议](https://github.com/rollup/rollup/wiki/pkg.module) 它一方面包括捆绑大小优化的无害环境管理,而另一方面包括一个UMD版本,以与每个以前的javascript捆绑/结扎战略相兼容.

Gondel已完全打入,并导出用于打字项目的可选打字声明文件.

## 插件

-   [数据插件](https://github.com/merkle-open/gondel/tree/master/packages/plugins/data) - 自动装订数据属性 -- [演示](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/plugin-data)
-   [热插件](https://github.com/merkle-open/gondel/tree/master/packages/plugins/hot) - 为刚德尔组件添加热-模块-重装(hmr)支持。 - [演示](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/typescript)
-   [查询插件](https://github.com/merkle-open/gondel/tree/master/packages/plugins/jquery) - 添加对方便访问当前 ctx 作为 jQuery 收藏的支持 .
-   [媒体查询插件](https://github.com/merkle-open/gondel/tree/master/packages/plugins/media-queries) - 提供自定义的gondel事件,一旦满足了特定的媒体查询,就会开火- [演示](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/plugin-media-query)
-   [反应插件](https://github.com/merkle-open/gondel/tree/master/packages/plugins/resize) - 使用Gondel和反之亦然,在靴子陷阱中添加支持 React 部件和应用程序 [演示](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/gondel-react)
-   [调整插件大小](https://github.com/merkle-open/gondel/tree/master/packages/plugins/resize) - 提供窗口或组件调整大小时的事件 - [演示](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/plugin-resize)

## 游戏场

[https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/hello-world 互联网档案馆的存檔,存档日期2013-12-12](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/hello-world)

## 实例

-   [哈罗世界](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/hello-world)
-   [分块](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/lazy-load)
-   [星等评分](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/five-star)
-   [有打字符的贡德尔](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/typescript)
-   [使用 React 中的贡德尔](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/react-gondel)
-   [使用来自贡德尔的回放](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/gondel-react)
-   [通信获取组件ByDom节点](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/get-component-by-dom-node)
-   [通讯查找](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/find-components)
-   [通讯触发事件](https://codesandbox.io/s/github/merkle-open/gondel/tree/master/examples/trigger-public-event)

## 向贡德尔捐款

欢迎所有贡献:使用大小写,文档,代码,补丁,错误报告,特性请求等.  
下列命令会让您开始本地工作 :

```
npm install
npm run build
```

运行中的测试 :

```
npm run test:watch
```

感谢所有捐款者(截至2000年12月31日)[emoji 密钥](https://allcontributors.org/docs/en/emoji-key)迄今为止:

| [![](https://avatars2.githubusercontent.com/u/4113649?v=4)  
**扬·尼克拉斯**](https://twitter.com/jantimon)  
[💻](https://github.com/merkle-open/gondel/commits?author=jantimon "Code") [📖](https://github.com/merkle-open/gondel/commits?author=jantimon "Documentation") [🐛](https://github.com/merkle-open/gondel/issues?q=author%3Ajantimon "Bug reports") [💡](https://npmcn.com/package/%40gondel/core/#readme-example-jantimon "Examples") [🚇](https://npmcn.com/package/%40gondel/core/#readme-infra-jantimon "Infrastructure (Hosting, Build-Tools, etc)") [🔌](https://npmcn.com/package/%40gondel/core/#readme-plugin-jantimon "Plugin/utility libraries") [⚠️](https://github.com/merkle-open/gondel/commits?author=jantimon "Tests") [👀](https://npmcn.com/package/%40gondel/core/#readme-review-jantimon "Reviewed Pull Requests") | [![](https://avatars1.githubusercontent.com/u/149406?v=4)  
**恩斯特·安曼**](https://github.com/ernscht)  
[💻](https://github.com/merkle-open/gondel/commits?author=ernscht "Code") [📖](https://github.com/merkle-open/gondel/commits?author=ernscht "Documentation") [🚇](https://npmcn.com/package/%40gondel/core/#readme-infra-ernscht "Infrastructure (Hosting, Build-Tools, etc)") [📦](https://npmcn.com/package/%40gondel/core/#readme-platform-ernscht "Packaging/porting to new platform") [👀](https://npmcn.com/package/%40gondel/core/#readme-review-ernscht "Reviewed Pull Requests") | [![](https://avatars1.githubusercontent.com/u/9339019?v=4)  
**杜桑·佩尔科维奇**](https://github.com/noblica)  
[💻](https://github.com/merkle-open/gondel/commits?author=noblica "Code") [📖](https://github.com/merkle-open/gondel/commits?author=noblica "Documentation") [🔌](https://npmcn.com/package/%40gondel/core/#readme-plugin-noblica "Plugin/utility libraries") [🤔](https://npmcn.com/package/%40gondel/core/#readme-ideas-noblica "Ideas, Planning, & Feedback") [⚠️](https://github.com/merkle-open/gondel/commits?author=noblica "Tests") | [![](https://avatars1.githubusercontent.com/u/4563751?v=4)  
**扬·比亚西**](https://aviormusic.com/)  
[💻](https://github.com/merkle-open/gondel/commits?author=janbiasi "Code") [📖](https://github.com/merkle-open/gondel/commits?author=janbiasi "Documentation") [🤔](https://npmcn.com/package/%40gondel/core/#readme-ideas-janbiasi "Ideas, Planning, & Feedback") [⚠️](https://github.com/merkle-open/gondel/commits?author=janbiasi "Tests") [👀](https://npmcn.com/package/%40gondel/core/#readme-review-janbiasi "Reviewed Pull Requests") | [![](https://avatars1.githubusercontent.com/u/3381820?v=4)  
**扬·维德默**](https://github.com/janwidmer)  
[💻](https://github.com/merkle-open/gondel/commits?author=janwidmer "Code") [📖](https://github.com/merkle-open/gondel/commits?author=janwidmer "Documentation") [💡](https://npmcn.com/package/%40gondel/core/#readme-example-janwidmer "Examples") [🤔](https://npmcn.com/package/%40gondel/core/#readme-ideas-janwidmer "Ideas, Planning, & Feedback") [🔌](https://npmcn.com/package/%40gondel/core/#readme-plugin-janwidmer "Plugin/utility libraries") | [![](https://avatars1.githubusercontent.com/u/3457712?v=4)  
**克劳迪奥·比亚努奇**](https://github.com/chezdev)  
[💻](https://github.com/merkle-open/gondel/commits?author=chezdev "Code") [🤔](https://npmcn.com/package/%40gondel/core/#readme-ideas-chezdev "Ideas, Planning, & Feedback") |
| :-: | :-: | :-: | :-: | :-: | :-: |
|  |  |  |  |  |  |

### 许可证

[麻省理工学院许可证](https://npmcn.com/package/LICENSE)

## 常见问题

### @gondel/core 是什么？

Gondel 库的基础核心

### 如何安装 @gondel/core？

在项目目录运行 npm install @gondel/core，或使用 pnpm add / yarn add / bun add。

### @gondel/core 支持 TypeScript 吗？

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

### @gondel/core 支持 ESM 还是 CommonJS？

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

### @gondel/core 可以商用吗？

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

### @gondel/core 的下载量有多少？

根据 npm 官方下载统计，@gondel/core 在 2026/10/17 – 2026/11/15 这 30 天内被下载 3,488 次，日均约 116 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @gondel/core 还在维护吗？

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

