# useMouse
useMouse
♻️ Register MouseMove (opens new window) event on mounted, and remove event automatically on unmounted.
# Example
💡 Move your mouse
# Usage
<div class="wrapper">
Mouse Position: [X: {{ x }}, Y: {{ y }}]
</div>
1
2
3
2
3
import { useMouse } from '@vueblocks/vue-use-core'
export default {
setup () {
const { x, y, remove } = useMouse()
return {
x,
y
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# Typing
/**
* Register `MouseMove` event on mounted, and remove event automatically on unmounted.
*/
declare const useMouse: () => {
x: Ref<number>;
y: Ref<number>;
remove: () => void;
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8