nuxt.js – "window is not defined" with nuxtjs generated in my default layout template

I receive the error message "The window is not defined" if I use "window" in my default.vue template in the layouts folder. Building static pages with "npm run generate" creates the error message. The mode is set to "universal"

...
created: {
window.addEventlistener (& # 39; scroll & # 39 ;, e => {
console.log (& # 39; scrollleeed & # 39;)
})
}
...

What am I doing wrong? I thought that "generate" would create static pages and that everything would be run on the client side.