@mdui/jq
Version:
拥有和 jQuery 相似 API 的轻量级 JavaScript 工具库
22 lines (21 loc) • 672 B
TypeScript
declare module '../shared/core.js' {
interface JQ<T = HTMLElement> {
/**
* 遍历当前集合,为集合中每一个元素执行一个函数。
* @param callback
* 执行的回调函数
*
* 函数的第一个参数为元素的索引位置,第二个参数为当前元素,`this` 指向当前元素
*
* 如果函数返回 `false`,则结束遍历。
* @example
```js
$('img').each(function (index, element) {
this.src = 'test' + index + '.jpg';
});
```
*/
each(callback: (this: T, index: number, element: T) => unknown): this;
}
}
export {};