I am facing an issue with my two pages or "views" that have identical JS code. Both pages have a window.onload function where I perform some actions:
console.log("loading")
window.onload = function() {
console.log("loaded")
// do stuff
}
The problem is that window.onload
is being skipped and not executed at all on one of the pages, never reaching the console.log("loaded")
statement.
Interestingly, window.onload
works perfectly fine on the main page (Index.vue
) but fails to execute when navigating to the secondary page (About.vue
). I suspect it might be related to how Vue.js loads components using the router. Can anyone help me identify the issue?