You can simply use NuxtApp hooks. I use that in my default layout and work like a charm.
<script setup lang="ts"> const nuxtApp = useNuxtApp(); nuxtApp.hook('page:loading:end', () => { // doSomething(); }); </script>