0👍
As a followup on my comment: you can mount a separate Vue instance. You can do it with something like this:
createNewInstance: function(){
const splash = new Vue({
methods: {
closeHandler() {
return function() {
splash.$destroy();
splash.$el.remove();
};
}
},
render(h) {
return h(YourSplashComponent, {
mounted() {
setTimeout(this.closeHandler(), 3000)
}
});
}
}).$mount();
document.body.appendChild(splash.$el);
}
Just be sure to import and create a component on where YourSplashComponent
is stated in the example.
Call the function right before you do trigger your route
- [Vuejs]-Hide popup box when clicked anywhere on the document
- [Vuejs]-How to apply style to a VueJS Component with Style marker
0👍
If you have 9 different routes a user can be directed to, could you:
- create a modal component
- load it into these views/routes
- open it when the route is mounted
This way the modal code is centralized in its own component, and can watch for a property change to appear.
Source:stackexchange.com