Reputation: 23211
I am getting error as window
is not defined in afterEach
route hooks.
router.afterEach((to, from) => {
console.log(window);
// need to track ga event here.
});
I think afterEach
route hooks execute on server-side render-time, so window
is undefined here. please correct me if i am doing wrong here. if i am not wrong, then is there any router hooks which only execute on client side?
Upvotes: 0
Views: 652