antd-mini
Version:
antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。
17 lines (16 loc) • 444 B
text/typescript
/* eslint-disable @typescript-eslint/no-explicit-any */
export default function fmtEvent(
props: Record<string, any>,
e: Record<string, any> = {}
): Record<string, any> {
const dataset = {};
for (const key in props) {
if (/data-/gi.test(key)) {
dataset[key.replace(/data-/gi, '')] = props[key];
}
}
return Object.assign({}, e, {
currentTarget: { dataset },
target: { dataset, targetDataset: dataset },
});
}