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

Server-side directives aren't applied on custom components #6575

Closed
samburgers opened this issue Oct 16, 2019 · 3 comments
Closed

Server-side directives aren't applied on custom components #6575

samburgers opened this issue Oct 16, 2019 · 3 comments

Comments

@samburgers
Copy link

Version

v2.10.1

Reproduction link

https://codesandbox.io/s/codesandbox-nuxt-dyu6u

Steps to reproduce

Strange one... Nuxt Custom Directives don't seem to register on imported Components (but do work when added to regular template HTML)

  <section>
    <div v-custom1="`this works`">Hello</div>
    <HelloWorld v-custom1="`this doesnt work`"/>
  </section>
  render: {
    bundleRenderer: {
      directives: {
        custom1(el, dir) {
          console.log("custom1", dir);
        }
      }
    }
  },

Reproduction:

https://codesandbox.io/s/codesandbox-nuxt-dyu6u

What is expected ?

Should log both custom directives

What is actually happening?

Only logs the first custom directive. Adding a custom directive to a custom component doesnt register.

This bug report is available on Nuxt community (#c9915)
@ghost ghost added the cmty:bug-report label Oct 16, 2019
@manniL manniL changed the title Nuxt Custom Directives don't seem to register on imported Components (but do work on regular template HTML) Server-side directives aren't applied on custom components Oct 20, 2019
@manniL
Copy link
Member

manniL commented Oct 20, 2019

Hey 👋

Looks like a vue-server-renderer bug to me. Will investigate.

Anyway, you are registering "only" server-side directives here. If you want the typical (client-side) one, you can use a Nuxt plugin to register them globally or use the directives attribute on a specific component or page.

Further read on server-side directives in my blog post

@manniL
Copy link
Member

manniL commented Oct 20, 2019

Closing here as it is a vue server renderer bug indeed. Further info in vuejs/vue#10733

@manniL
Copy link
Member

manniL commented Aug 25, 2022

Resolved via vuejs/vue#12661 (v2.7.9 and up)

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

No branches or pull requests

3 participants