[Vuejs]-Why my routing does not work properly after changing to lazy-load routing in vue-js?

0👍

I think the issue might come from using this function on created():

created() {
            window.addEventListener('beforeunload', this.rouFunc() );
        },

what you could do is to call this.rouFunc() directly on created(), because the window.addEventListener won’t be triggered, as created() is done synchronously after the instance is created (see the lifecycle hooks for Vue2 here).

Leave a comment