Answer the question
In order to leave comments, you need to log in
How to call a component with a template from a method?
Hey! How is it possible, when calling a method in a component, to display its template?
For example, we want to make an alert or confirm window, and in order not to embed modals in the template block every time, but simply call methods and this.dialog.confirm () component appeared
methods: {
confirm () {
this.dialog.confirm().then(() => {
console.log('ok')
}, () => {
console.log('cancel')
}
})
}
Answer the question
In order to leave comments, you need to log in
You manually create an instance, manually add $el to the DOM tree, and manually delete it in the same way.
Alert , for example. And here is confirm .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question