Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 226 KB

File metadata and controls

27 lines (16 loc) · 226 KB

useMouse medium #Composable Function

By webfansplz @webfansplz

Take the Challenge    Take the Challenge(Passed unit tests)    简体中文

We should focus on reusability when using Vue.js. Composables are a great way to ensure this. Let's go 👇:

<script setup lang="ts">

// Implement ...
function useEventListener(target, event, callback) {

}

// Implement ...
function useMouse() {
  useEventListener(window, "mousemove", () => {})
}
const { x, y } = useMouse()
</script>

<template>Mouse position is at: {{ x }}, {{ y }}</template>


Back Share your Solutions Check out Solutions