1

We are using vue-js-modal in our project, and I want to open a modal from code which isn't in a vue component. The documentation only indicate how to use the API from a component. There is a way to manipulate vue-js-modal from anywhere ?

The X problem, I want to warn user with a popup when a router error occure in router.onError((error)=>...)

fabien-michel
  • 1,873
  • 19
  • 38

1 Answers1

2

Instantiating a new Vue object, allow to acces the $modal API entrypoint :

const vue = new Vue();
vue.$modal.show({template:'<div>Error during loading...</div>'});
fabien-michel
  • 1,873
  • 19
  • 38