11<div align =" center " >
22 <h1 >@rc-component/mutate-observer</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
54 <p >👁️ 轻量 React DOM 变更观察组件。</p >
65</div >
76
2221
2322## 特性
2423
25- - Component and hook APIs for observing changes to a rendered DOM node.
26- - Passes ` MutationRecord[] ` and the native ` MutationObserver ` instance to ` onMutate ` .
27- - 支持 the full native ` MutationObserverInit ` options object.
28- - TypeScript definitions for component props and hook usage.
29- - 被 Ant Design 使用 as a small DOM observation primitive.
24+ - 用于观察渲染的 DOM 节点变化的组件和钩子 API。
25+ - 将 ` MutationRecord[] ` 和本机 ` MutationObserver ` 实例传递给 ` onMutate ` 。
26+ - 支持完整的本机 ` MutationObserverInit ` 选项对象。
27+ - 组件 props 和 hook 用法的 TypeScript 定义。
28+ - 被 Ant Design 用作小型 DOM 观察原语。
3029
3130## 安装
3231
@@ -80,17 +79,17 @@ npm start
8079
8180| 参数 | 类型 | 默认值 | 说明 |
8281| -------- | ------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------- |
83- | children | ` React.ReactNode ` | - | Node to render and observe. |
84- | options | ` MutationObserverInit ` | - | Native observer options such as ` attributes ` , ` childList ` , and ` subtree ` . |
85- | onMutate | ` (mutations: MutationRecord[], observer: MutationObserver) => void ` | - | Triggered when observed mutations are reported. |
82+ | children们 | ` React.ReactNode ` | - | 要渲染和观察的节点。 |
83+ | 选项 | ` MutationObserverInit ` | - | 本机观察者选项,例如 ` attributes ` 、 ` childList ` 和 ` subtree ` 。 |
84+ | onMutate | ` (mutations: MutationRecord[], observer: MutationObserver) => void ` | - | 当报告观察到的突变时触发。 |
8685
8786### useMutateObserver
8887
8988``` ts
9089useMutateObserver (target , callback , options );
9190```
9291
93- The hook observes the provided target element or element array with the same callback and native ` MutationObserverInit ` options used by the component.
92+ 该 Hook 会用与组件相同的回调和原生 ` MutationObserverInit ` 配置监听目标元素或元素数组。
9493
9594## 本地开发
9695
@@ -109,11 +108,11 @@ npm run build
109108npm run prepublishOnly
110109```
111110
112- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
111+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
113112
114113## 许可证
115114
116- @rc-component/mutate-observer is released under the [ MIT] ( ./LICENSE ) license.
115+ @rc-component/mutate-observer 基于 [ MIT] ( ./LICENSE ) 许可证发布。
117116
118117[ npm-image ] : https://img.shields.io/npm/v/@rc-component/mutate-observer.svg?style=flat-square
119118[ npm-url ] : https://npmjs.org/package/@rc-component/mutate-observer
0 commit comments