How to use the vue-composable.useEvent function in vue-composable

To help you get started, we’ve selected a few vue-composable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pikax / vue-composable / docs / .vuepress / components / EventExample.vue View on Github external
setup(_){
    const elref = ref(null);
    const state = reactive({
      x: 0,
      y: 0
    })
    const remove = useEvent(elref, 'mousemove', e=> {
      state.x = e.x;
      state.y = e.y;
    })

    return {
      elref,
      remove,
      state
    }
  }
}