You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
458 B
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 用于处理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
}
}
}
}