Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
How to register custom directive in vue 3 <script setup>

I can't find this in the docs. There is only info on registering it global on the app

Is it possible to register a custom scoped directive with the <script setup>?

If I use regular script I have something like this:

<script>
import { defineComponent } from 'vue'
import { customDirective } from './customDirective';

export default defineComponent({
  directives: { customDirective }
})
</script>

Now with <script setup>:

<script setup>
// how to register this
import { customDirective } from './customDirective';
</script>

If I leave it like that, I get the error in the console

Failed to resolve directive

Any help is appreciated

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to resolve it with the v prefix.

<script setup>
import { customDirective as vCustomDirective } from './customDirective';
</script>

See the docs.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda