I want to fetch h1 whenever the page changes to another page but try updated it didn't work in nuxt , I want to write js code that works when entering any page
Tried this but the result is null
export default async ({ app }) => {
app.router.afterEach((to, from) => {
console.log(document.querySelector("h1"))
});
}
In vue I was using Vue.mixin and (updated) now on nuxt I don't know how to do it