export default {
mounted() {
setTimeout(function() {
this.$emit('onLoad')
}, 4000);
}
} //views/Load.vue
I want to move to another page when 4seconds after page access.
<template>
<div id="app">
<transition name="fade" mode="out-in">
<router-view
@onLoad="changeRoute('login')">
</router-view>
</transition>
</div>
</template>
<script>
export default {
name: 'app',
methods: {
changeRoute (routeName) {
this.$router.push({ name: routeName })
}
}
}
</script> //App.vue
I want to send a signal to 'App.vue' by '$emit' and then go to the page that is connected by router.
All routers are connected properly.
but the error of "Uncaught TypeError: this.$emit is not a function" apperas.
How can I do?