jiangchengfeiyi-xiaochengxu/uni_modules/zp-mixins/methods/dataset.js

22 lines
437 B
JavaScript
Raw Normal View History

2025-04-02 15:45:33 +00:00
/**
* 用于处理dataset
* 自定义组件的事件里是获取不到e.currentTarget.dataset的
* 因此收集data-参数手动传进去
*
* @param {*} event
* @param {*} dataSet
*/
export function handleDataset(event, dataSet = {}) {
if (event && !event.currentTarget) {
if (dataSet.tagId) {
event.currentTarget = {
id: dataSet.tagId
}
} else {
event.currentTarget = {
dataset: dataSet
}
}
}
}