Though I'm routed to 'myFavouritePage', but 'Hi, I'm child' is getting printed after routing to 'myFavouritePage'. Is there a function in parent, which upon completion creates the child components? Parent:
beforeCreate () {
    var orderNumber = this.$store.state.myStore.order.number
    if (!orderNumber) {
        this.$router.push({name: 'myFavouritePage'})
    }
}
Child:
mounted () {
    cosole.log('Hi, I'm child')
}
To shed some light on what is the order of different life cycle events, following is the order in which they take place:
However for you purpose as suggested by me and @Srinival, you can use beforeRouteEnter to decide whether you want to go ahead with the rendering or want to redirect to other route.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With