mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-29 17:58:08 +08:00
chore(components): [dropdown] format (#10465)
refactor(components): [dropdown] Co-authored-by: qiang <qw13131wang@gmail.com>
This commit is contained in:
parent
811a2f75cf
commit
96a081b755
@ -87,15 +87,10 @@ export default defineComponent({
|
||||
})
|
||||
)
|
||||
|
||||
const handlePointerLeave = composeEventHandlers(
|
||||
(e: PointerEvent) => {
|
||||
emit('pointerleave', e)
|
||||
return e.defaultPrevented
|
||||
},
|
||||
whenMouse((e) => {
|
||||
onItemLeave(e)
|
||||
})
|
||||
)
|
||||
const handlePointerLeave = composeEventHandlers((e: PointerEvent) => {
|
||||
emit('pointerleave', e)
|
||||
return e.defaultPrevented
|
||||
}, whenMouse(onItemLeave))
|
||||
|
||||
const handleClick = composeEventHandlers(
|
||||
(e: PointerEvent) => {
|
||||
@ -118,9 +113,7 @@ export default defineComponent({
|
||||
)
|
||||
|
||||
// direct usage of v-bind={ ...$props, ...$attrs } causes type errors
|
||||
const propsAndAttrs = computed(() => {
|
||||
return { ...props, ...attrs }
|
||||
})
|
||||
const propsAndAttrs = computed(() => ({ ...props, ...attrs }))
|
||||
|
||||
return {
|
||||
handleClick,
|
||||
|
@ -104,8 +104,8 @@ export default defineComponent({
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
if (target !== unref(contentRef)) return
|
||||
if (!FIRST_LAST_KEYS.includes(code)) return
|
||||
if (target !== unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
|
||||
return
|
||||
const items = getItems<{ disabled: boolean }>().filter(
|
||||
(item) => !item.disabled
|
||||
)
|
||||
|
@ -157,9 +157,7 @@ export default defineComponent({
|
||||
const trigger = computed(() => ensureArray(props.trigger))
|
||||
|
||||
const defaultTriggerId = useId().value
|
||||
const triggerId = computed<string>(() => {
|
||||
return props.id || defaultTriggerId
|
||||
})
|
||||
const triggerId = computed<string>(() => props.id || defaultTriggerId)
|
||||
|
||||
// The goal of this code is to focus on the tooltip triggering element when it is hovered.
|
||||
// This is a temporary fix for where closing the dropdown through pointerleave event focuses on a
|
||||
|
@ -30,9 +30,7 @@ export const initDropdownDomEvent = (
|
||||
|
||||
function removeTabindex() {
|
||||
triggerElm.setAttribute('tabindex', '-1')
|
||||
menuItemsArray.value?.forEach((item) => {
|
||||
item.setAttribute('tabindex', '-1')
|
||||
})
|
||||
menuItemsArray.value?.forEach((item) => item.setAttribute('tabindex', '-1'))
|
||||
}
|
||||
|
||||
function resetTabindex(ele) {
|
||||
|
Loading…
Reference in New Issue
Block a user