Skip to content
New issue

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

Nuxt 3 module: Custom directive not working - using example from docs #131

Closed
PatrikBird opened this issue Jun 11, 2023 · 4 comments · Fixed by #132
Closed

Nuxt 3 module: Custom directive not working - using example from docs #131

PatrikBird opened this issue Jun 11, 2023 · 4 comments · Fixed by #132

Comments

@PatrikBird
Copy link

Hello there,

thanks for creating such an amazing library! I love it ❤️.

I'm not able to create custom directives in Nuxt using the example mentioned in the docs:

{
  // nuxt.config.js
  motion: {
    directives: {
      'pop-bottom': {
        initial: {
          scale: 0,
          opacity: 0,
          y: 100
        },
        visible: {
          scale: 1,
          opacity: 1,
          y: 0
        },
      }
    }
  }
}

When I try to use the custom directive like:

<p v-motion-bottom-pop>I am supposed to be animated by a custom directive using @vueuse/motion!</p>

I get the following error:
[Vue warn]: Failed to resolve directive: motion-bottom-pop

Using presets works without any issue.
I recreated the issue here: https://stackblitz.com/edit/nuxt-starter-7pqo1q?file=app.vue

Nuxt: 3.5.2
Vueuse/motion: 2.0

@cjboy76
Copy link
Contributor

cjboy76 commented Jun 11, 2023

@PatrikBird
The directive you defined in nuxt.config.js is pop-bottom, but you use <p v-motion-bottom-pop> instead.
Also I create a PR for exposing config to clients, it should fix the issue.

@PatrikBird
Copy link
Author

PatrikBird commented Jun 12, 2023

Oh okay sorry. I messed the repro... it's corrected now and I can't get it working either.. same error.
Am I doing something wrong?

I declared this:

motion: {
  directives: {
    'pop-bottom': {
...

I use it like this:

<div v-motion-pop-bottom>

And get this: [Vue warn]: Failed to resolve directive: motion-pop-bottom (local env and stackblitz).
Again, the presets work.

Appreciate your quick response!

@jetlej
Copy link

jetlej commented Oct 15, 2023

This also doesn't work for me. Same exact example code from above.

No animation is triggered whatsoever

@PatrikBird
Copy link
Author

PatrikBird commented Nov 19, 2023

It looks hardly maintained. The fix never got released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants