A
A
Andrey Rakovskiy2020-09-08 00:17:11
Vue.js
Andrey Rakovskiy, 2020-09-08 00:17:11

How to inject the contents of a Vue component into Swal2?

There are two Vue components:
list - Display a list of users and at the bottom the "Add" button
selected - Display users that can be selected

Initially, the first component is displayed on the page, it is necessary that when you click on the "Add" button, the swal2 modal window opens and the component is drawn in this window selected.
Then when we select some users and close the modal window, the selected users will have to be loaded and rendered in the first list component.

On JQuery, this was done in two simple steps:
1) Inserted content into the modal window
2) When the window was closed, rendered the selected users on the page

I don't know how to do it in Vue. My whole problem is to put the component in a modal window.
I did it in jquery like this:

$("#swal2-content").html($("#template-modal"));

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question