[Vuejs]-Get HTML from Vuetify components without posting it on the dom

0👍

I’m not entirely sure what your use case is for this. If you could elaborate on what you’re trying to achieve, I could likely give a better answer.

I’ve had some similar requirement in the past, where I needed to access the entire HTML content of components/sub-components.

How I did this was by rendering the components in an iframe. From there, you can access and modify the mounted iframe DOM.

I can’t find the source code on how I did this but perhaps concept/approach could serve as a starting point.

From a cursory internet search, I found this link https://jsfiddle.net/ohznser9/ with a JS Fiddle demonstrating a i-frame component that takes Vue components as a slot.

I’d imagine you could extend this component to add functionality to modify or extract elements from the DOM.

Perhaps you could load the iframe invisibly, grab the DOM elements from that and do what you wish with them

Leave a comment