Open
Description
import { ref } from "vue"
// Implement ...
function useEventListener(target, event, callback) {
target.addEventListener(event,callback)
}
// Implement ...
function useMouse() {
const x = ref(0)
const y = ref(0)
useEventListener(window, "mousemove", (e) => {
x.value = e.x
y.value = e.y
})
return {
x,y
}
}