0๐
On mounted trigger you can add your custom js for each component
<script>
export default {
mounted () {
}
}
</script>
0๐
if anyone stumbles upon this and still looking for a way to do it, this is how I managed to do this. wrap the <route-view/>
in a <transition>
which you can control with css and call a method on enter which calls the function you want.
this will call the function as soon as the component is loaded in the DOM on every route change
<transition name="slide" v-on:enter="reInitJS">
<router-view></router-view>
</transition>
<script>
//import the wanted function
import {init} from './main';
export default {
name: 'App',
methods: {
reInitJS(){
//call the function
init();
}
}
}
</script>
- [Vuejs]-Accessing the JSON fulfillmentValue value
- [Vuejs]-Rendering escaped HTML from api call with vue.js
Source:stackexchange.com