mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-09 02:31:33 +08:00
fix: el-input add mouseenter mouseleave event (#349)
This commit is contained in:
parent
4263299c74
commit
a5611000da
@ -15,8 +15,8 @@
|
||||
$attrs.class
|
||||
]"
|
||||
:style="$attrs.style"
|
||||
@mouseenter="hovering = true"
|
||||
@mouseleave="hovering = false"
|
||||
@mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave"
|
||||
>
|
||||
<template v-if="type !== 'textarea'">
|
||||
<!-- 前置元素 -->
|
||||
@ -222,7 +222,8 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
|
||||
emits: [UPDATE_MODEL_EVENT, 'input', 'change', 'focus', 'blur', 'clear'],
|
||||
emits: [UPDATE_MODEL_EVENT, 'input', 'change', 'focus', 'blur', 'clear',
|
||||
'mouseleave', 'mouseenter'],
|
||||
|
||||
setup(props, ctx) {
|
||||
const instance = getCurrentInstance()
|
||||
@ -448,6 +449,16 @@ export default defineComponent({
|
||||
nextTick(updateIconOffset)
|
||||
})
|
||||
|
||||
const onMouseLeave = e => {
|
||||
hovering.value = false
|
||||
ctx.emit('mouseleave', e)
|
||||
}
|
||||
|
||||
const onMouseEnter = e => {
|
||||
hovering.value = true
|
||||
ctx.emit('mouseenter', e)
|
||||
}
|
||||
|
||||
return {
|
||||
input,
|
||||
textarea,
|
||||
@ -478,6 +489,8 @@ export default defineComponent({
|
||||
focus,
|
||||
blur,
|
||||
getSuffixVisible,
|
||||
onMouseLeave,
|
||||
onMouseEnter,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user