# @egjs/children-differ 中文文档

规范地址：https://npmcn.com/package/%40egjs/children-differ/

版本：1\.0\.1
npm 元数据更新时间：2025-10-24T06:49:48.956Z
中文译文更新时间：2026-11-13T09:06:19.528Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：110 kB，30 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：1 个
- 首次发布：2019-05-13T08:05:50.738Z
- 最新版本发布：2020-05-12T04:29:35.345Z
- 近 30 天下载量：3378254（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 0 个）

## 中文简介

当添加、删除或更改儿童元素时检查 diff 的模块

## 安装

```sh
npm install @egjs/children-differ
```

也可以使用：`pnpm add @egjs/children-differ`、`yarn add @egjs/children-differ`、`bun add @egjs/children-differ`

## README

![](https://raw.githubusercontent.com/naver/egjs-list-differ/master/demo/images/logo.png)

## @egjs/ 儿童差异

[![version](https://img.shields.io/npm/v/@egjs/children-differ.svg?style=flat-square&color=007acc&label=version&logo=NPM)](https://www.npmjs.com/package/@egjs/children-differ) [![Travis (.org)](https://img.shields.io/travis/naver/egjs-children-differ.svg?style=flat-square&label=build&logo=travis%20ci)](https://travis-ci.org/naver/egjs-children-differ) [![Coveralls github](https://img.shields.io/coveralls/github/naver/egjs-children-differ.svg?style=flat-square&label=%E2%9C%85%20coverage)](https://coveralls.io/github/naver/egjs-children-differ?branch=master&style=flat-square) [![npm downloads per month](https://img.shields.io/npm/dm/@egjs/children-differ.svg?style=flat-square&label=%E2%AC%87%20downloads&color=08CE5D)](https://www.npmjs.com/package/@egjs/children-differ) [![GitHub](https://img.shields.io/github/license/naver/egjs-children-differ.svg?style=flat-square&label=%F0%9F%93%9C%20license&color=08CE5D)](https://github.com/naver/egjs-children-differ/blob/master/LICENSE)

QQ 模块,用于检查 diff 当添加、去除或更改孩子元素时.

## \* 安装

```sh
$ npm i @egjs/children-differ
```

```html
<script src="//naver.github.io/egjs-children-differ/release/latest/dist/children-differ.pkgd.min.js"></script>
```

## 页:1

-   见 [**文档**](https://naver.github.io/egjs-children-differ/release/latest/doc/index.html) 页 次.
-   [引入列表差异以跟踪数据和跟踪变化](https://medium.com/naver-fe-platform/introducing-listdiffer-to-track-changes-in-data-27793f0c6f4a)(单位:千美元)[한국어](https://medium.com/naver-fe-platform/%EB%8D%B0%EC%9D%B4%ED%84%B0%EC%9D%98-%EB%B3%80%ED%99%94%EB%A5%BC-%EC%95%8C%EC%95%84%EB%82%B4%EA%B3%A0-%EB%B3%80%ED%99%94-%EA%B3%BC%EC%A0%95%EC%9D%84-%EC%B6%94%EC%A0%81-%ED%95%98%EB%8A%94-listdiffer-9c3f1d770542)(中文(简体) )
-   [如何建立跨框架构成部分](https://medium.com/naver-fe-platform/how-to-make-cross-framework-component-ee76d76708b1)(单位:千美元)[한국어](https://medium.com/naver-fe-platform/cross-framework-component%EB%A5%BC-%EB%A7%8C%EB%93%9C%EB%8A%94-%EB%B0%A9%EB%B2%95-234b3fece353)(中文(简体) )

## • 软件包

| 软件包 | 版本 | 说明 |
| :-: | :-: | :-: |
| [**@egjs/ react- children-differ (英语)**](https://github.com/naver/egjs-children-differ/blob/master/packages/react-children-differ/README.md) | [![version](https://img.shields.io/npm/v/@egjs/react-children-differ.svg?style=flat-square&color=00d8ff&label=%F0%9F%94%96)](https://www.npmjs.com/package/@egjs/react-children-differ) | ![React](https://naver.github.io/egjs-flicking/images/react.svg) [反应](https://reactjs.org/) @egjs/ children-differ 的端口 |
| [**@egjs/ngx- 儿童- differ**](https://github.com/naver/egjs-children-differ/blob/master/packages/ngx-children-differ/README.md) | [![version](https://img.shields.io/npm/v/@egjs/ngx-children-differ.svg?style=flat-square&color=dd0031&label=%F0%9F%94%96)](https://www.npmjs.com/package/@egjs/react-children-differ) | ![Angular](https://naver.github.io/egjs-flicking/images/angular.svg) [角质](https://angular.io/) @egjs/ children-differ 的端口 |
| [**@egjs/vue- children-differ (英语)**](https://github.com/naver/egjs-children-differ/blob/master/packages/vue-children-differ/README.md) | [![version](https://img.shields.io/npm/v/@egjs/vue-children-differ.svg?style=flat-square&color=42b883&label=%F0%9F%94%96)](https://www.npmjs.com/package/@egjs/vue-children-differ) | ![Vue.js](https://naver.github.io/egjs-flicking/images/vue.svg) [Vue.js (英语)](https://vuejs.org/v2/guide/index.html) @egjs/ children-differ 的端口 |

## 使用方法

用法类似于 [**@ egjs/ list- divers**](https://github.com/naver/egjs-list-differ)。 。 。 .

### 检查 diff

```html
<div id="container">
    <div>0</div>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
</div>
<script>

import ChildrenDiffer from "@egjs/children-differ";

// Value is key
const differ = new ChildrenDiffer(conatiner.children);


container.removeChild(container.children[5]);
container.removeChild(container.children[2]);

const result = differ.update(container.children);
// [2, 5]
console.log(result.removed);
</script>
```

## 捐款

见 [捐款额](https://github.com/naver/egjs-children-differ/blob/master/CONTRIBUTING.md)。 。 。 .

## \* 反馈

请存档 [问题](https://github.com/naver/egjs-children-differ/issues)。 。 。 .

## 许可证

@egjs/list-differ 在下方发布 [麻省理工学院许可证](https://github.com/naver/egjs-children-differ/blob/master/LICENSE)。 。 。 .

```
Copyright (c) 2019-present NAVER Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```

## 常见问题

### @egjs/children-differ 是什么？

当添加、删除或更改儿童元素时检查 diff 的模块

### 如何安装 @egjs/children-differ？

在项目目录运行 npm install @egjs/children-differ，或使用 pnpm add / yarn add / bun add。

### @egjs/children-differ 支持 TypeScript 吗？

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

### @egjs/children-differ 支持 ESM 还是 CommonJS？

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

### @egjs/children-differ 可以商用吗？

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

### @egjs/children-differ 的下载量有多少？

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

### @egjs/children-differ 还在维护吗？

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

