We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to create a hook:
import { value, computed, watch, onMounted } from 'vue-function-api'; export function useIntersectionObserver() { let intersectionObserver; const entry = value({}); const callback = (entries) => { if (entries.length > 0) { entry.value = entries[entries.length - 1]; } }; onMounted(() => { intersectionObserver = new IntersectionObserver(callback); ... }); onUnmounted(() => { intersectionObserver.disconnect(); }); return { isIntersecting: computed(() => entry.isIntersecting) }; }
And use that in some component:
import { value, computed, watch, onMounted } from 'vue-function-api'; import useIntersectionObserver from '...'; export default { setup() { useIntersectionObserver(); } }
Yet, I get the error:
[vue-function-api] "onMounted" get called outside of "setup()"
Why is that, and how can I prevent this?
The text was updated successfully, but these errors were encountered:
Sorry. Can't reproduce it. https://codepen.io/liximomo/pen/KjXXBY?editors=1011
Sorry, something went wrong.
I use it at SSR (nuxt.js). Might be the cause? I'll provide a reproduction link tomorrow.
No branches or pull requests
I am trying to create a hook:
And use that in some component:
Yet, I get the error:
Why is that, and how can I prevent this?
The text was updated successfully, but these errors were encountered: