[Vuejs]-Vue js and dynamic components and content

0👍

Make the modal element where you want the HTML content to be have the attribute v-html="modalContent" and then in your vue code when you want to open that modal make your Ajax request and store the resulting HTML into this.modalContent

👤David

0👍

I solved it.

We need to put our modal component outside “#app” with needed html inside (Get it from AJAX) and initiate that instance as new vm.

And create wrapper to manage it like that

Modal = { show(), hide(), change() ... }

Of course hide method can destroy current modal window VM and whatever.

So after that we will have fully functional modal windows, hope that will help someone else.

Leave a comment