## vue3中的hook的使用
import { reactive,onMounted,onBeforeUnmount } from "vue"; export default function(){ let point = reactive({ x:0, y:0 }) function MyPoint(event){ point.x = event.pageX point.y = event.pageY console.log(event.pageY,event.pageX); } onMounted(()=>{ window.addEventListener('click',MyPoint) }) onBeforeUnmount(()=>{ window.removeEventListener('click',MyPoint) }) return point }