Level 35
Yeah it should work: https://vuejs.org/guide/reusability/composables.html#using-composables-in-options-api
I was actually curious if it could work without the setup method as well. This worked for me (you can see the code for useMouse in the docs posted above):
<template>
<div>
Mouse position is at: {{ x }}, {{ y }}
</div>
</template>
<script>
import { useMouse } from "../composables/useMouse"
export default {
data() {
return {
x: useMouse().x,
y: useMouse().y,
}
}
}
</script>