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
Using a async plugin in Vue2

I try to fetch a json file in a custom plugin in Vue. But the prototype created in the plugin cannot be ready yet before other components attempt to use it in mounted().

So, what am I doing wrong? Couldn't find anything remarkable in StackOverflow.

app.js

import Vue from "vue"

const Url = require("@/plugins/Url")

Vue.use(Url)

Url.js

import djangoJsReverse from "django-js-reverse"

export default {
  async install(Vue, options) {
    Vue.PLUGIN_VERSION = "0.0.1"

    console.log("pre install")

    const response = await fetch("/jsreverse/")
    const data = await response.json()

    console.log("post install")

    Vue.prototype.$urls = djangoJsReverse(data)
  }
}
about 4 years ago · Juan Pablo Isaza
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