export function getData(el, name, val) { const prefix = 'data-' if (val) { return el.setAttribute(prefix + name, val) } return el.getAttribute(prefix + name) }
export function getData(el, name, val) { const prefix = 'data-' if (val) { return el.setAttribute(prefix + name, val) } return el.getAttribute(prefix + name) }
转载于:https://www.cnblogs.com/hss-blog/p/9781816.html