Intento obtener un archivo json en un complemento personalizado en Vue. Pero el prototipo creado en el complemento aún no puede estar listo antes de que otros componentes intenten usarlo en mount().
Entonces, ¿qué estoy haciendo mal? No pude encontrar nada notable en StackOverflow.
aplicación.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) } }