Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!