mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-16 12:04:12 +08:00
docs: [tooltip] fix type error (#19687)
* docs: fix type error * docs: [tooltip] remove unnecessary width and height in mousemove handler * fix: update * fix: update
This commit is contained in:
@ -15,27 +15,24 @@
|
|||||||
import { onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
|
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const triggerRef = ref({
|
|
||||||
getBoundingClientRect() {
|
|
||||||
return position.value
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const position = ref({
|
const position = ref({
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
|
} as DOMRect)
|
||||||
|
|
||||||
|
const triggerRef = ref({
|
||||||
|
getBoundingClientRect: () => position.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
const mousemoveHandler = (e) => {
|
const mousemoveHandler = ({ clientX, clientY }: MouseEvent) => {
|
||||||
position.value = DOMRect.fromRect({
|
position.value = DOMRect.fromRect({
|
||||||
width: 0,
|
x: clientX,
|
||||||
height: 0,
|
y: clientY,
|
||||||
x: e.clientX,
|
|
||||||
y: e.clientY,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('mousemove', mousemoveHandler)
|
document.addEventListener('mousemove', mousemoveHandler)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user