alexjoverm / v-runtime-template

Vue component for compiling templates on the fly using a v-html like API
MIT License
605 stars 70 forks source link

Feature: optional callback prop for when dynamic component is mounted #84

Closed richardtallent closed 2 years ago

richardtallent commented 2 years ago

I'm using this component to render Vue components within HTML that is uses RevealJS to create a slideshow out of it. Unfortunately, RevealJS can only be initialized after the component has rendered into the DOM, and there's no event to hook into for that (at least that I could find).

So, this adds a prop called ready, which takes a callback function. When the dynamic component's loaded lifecycle event occurs, this callback function is fired, allowing the parent control to interact with the rendered DOM.

(I tried to make this an event first, but couldn't quite figure that one out.)

richardtallent commented 2 years ago

Oops -- I meant to do this in Matt's fork.