mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 10:18:02 +08:00
style: using 'Array.prototype.forEach()' (#1826)
This commit is contained in:
parent
f84befc00b
commit
62cffd67a4
@ -12,11 +12,11 @@ export default (el: Ref<HTMLElement>, events: Event[]) => {
|
||||
|
||||
watch(el, val => {
|
||||
if (val) {
|
||||
events.map(({ name, handler }) => {
|
||||
events.forEach(({ name, handler }) => {
|
||||
on(el.value, name, handler)
|
||||
})
|
||||
} else {
|
||||
events.map(({ name, handler }) => {
|
||||
events.forEach(({ name, handler }) => {
|
||||
off(el.value, name, handler)
|
||||
})
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ const attachEvents = (el: HTMLElement, binding: DirectiveBinding, vnode: VNode)
|
||||
popover.triggerRef = el
|
||||
el.setAttribute('tabindex', popover.tabindex)
|
||||
// because v-popover cannot modify the vnode itself due to it has already been
|
||||
Object.entries(popover.events).map(([eventName, e]) => {
|
||||
Object.entries(popover.events).forEach(([eventName, e]) => {
|
||||
on(el, eventName.toLowerCase().slice(2), e)
|
||||
})
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ export default function(
|
||||
}
|
||||
|
||||
if (isArray(props.trigger)) {
|
||||
Object.values(props.trigger).map(mapEvents)
|
||||
Object.values(props.trigger).forEach(mapEvents)
|
||||
} else {
|
||||
mapEvents(props.trigger as TriggerType)
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ export default defineComponent({
|
||||
let mapValues = Array.from(map.values()).reverse()
|
||||
let mapKeys = Array.from(map.keys()).reverse()
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
Array.from(h3).map(item => {
|
||||
Array.from(h3).forEach(item => {
|
||||
const text = item.childNodes[1].textContent.trim()
|
||||
map.set(text, item.offsetTop)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user