Hi I wanted to add a global windows error event listener to catch all errors in the UI using NUXT 3 so I added the below code in my menu.vue file which is always called. I am using the composition API
<template>
{{ error}}
</template>
<script setup lang="ts">
let error: any = ref();
window.addEventListener("error", function (ev) {
error = ev; //get the event object
ev.preventDefault; //this means dont stop the page from running
});
</script>
But i get the error 500 window is not defined. My menu file is a component so I dont understand why there is a problem? Regards Neale