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

155
Vistas
Access this.<module> from within Nuxt plugin

Is there any way I can access a JS API exposed by a Nuxt module from within a client-side plugin?

Context: I'm using Buefy/Bulma, which is loaded like this in nuxt.config.js:

modules: [
    ['nuxt-buefy', {css: false}],
],

Buefy exposes this.$buefy.<etc> which is accessible from components.

But I want to access this API from within a client-side plugin, utils.js, which is loaded like this:

plugins: ['~/plugins/utils.js'],

And utils.js itself:

export default ({app}, inject) => {
    inject('myUtil', (msg, isErr) => {
        app.$buefy; //<-- undefined
        ....

I assume this is an ordering issue, i.e. Buefy is being loaded after my plugin or something. I can't do this in a static JS file loaded via meta.scripts as that won't have access to the app (I assume).

Anything I can do here?

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

0

Try this in your plugin js file

import { ToastProgrammatic as toast } from 'buefy';

export default (_, inject) => {
  inject('appHelper', {
    displayToast(duration = null, msg = null, position = null, type = null) {
      toast.open({
        duration: duration || 3000,
        message: msg || 'Update Successful',
        position: position || 'is-bottom-left',
        type: type || 'is-success',
      });
    },
  });
};
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