I am currently working on a project involving a single-page application built with Vue.js and its official router.
For this project, I have set up a menu and a separate component (.vue file) for each section that is loaded using the router. Inside every component, you will find code similar to the following:
<template>
<div> <!-- MY DOM --> </div>
</template>
<script>
export default {
data () {},
methods: {},
route: {
activate() {},
},
ready: function(){}
}
</script>
My goal is to run a piece of code (initiating a jQuery plugin) once a component has completed transitioning in. If I place my code within the ready
event, it only runs the first time the component loads. If I use the route.activate
method, it executes every time but the DOM is not yet fully loaded, preventing me from initializing my jQuery plugin.
Is there a way for me to trigger my code each time a component finishes transitioning in and the DOM is fully rendered?