You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is my answer to challenge 25 , I guess this should pass the unit test……but I failed, and I tried someone else's answer and found that no one could pass the unit test…that's weird
<scriptsetuplang="ts">import { ref, onMounted, onUnmounted } from'vue';// Implement ...function useEventListener(target, event, callback) {onMounted(() =>target.addEventListener(event, callback));onUnmounted(() =>target.removeEventListener(event, callback));}// Implement ...function useMouse() {const x =ref(0);const y =ref(0);useEventListener(window, 'mousemove', (e) => {x.value=e.pageX;y.value=e.pageY; });return { x, y };}const { x, y } =useMouse();</script>
<template>Mouse position is at: {{ x }}, {{ y }}</template>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, this is my answer to challenge 25 , I guess this should pass the unit test……but I failed, and I tried someone else's answer and found that no one could pass the unit test…that's weird
Beta Was this translation helpful? Give feedback.
All reactions