I've this code:
<template>
<Header @menuClicked="() => (showSideBar = !showSideBar)" />
<main :showSideBar="showSideBar">
<NuxtPage />
</main>
<Footer />
</template>
<script>
export default defineNuxtComponent({
data() {
return { showSideBar: true }
},
created() {
if (!process.client) return
if (globalThis.window.innerWidth <= 800) {
this.showSideBar = false
}
}
})
</script>
So, by default showSideBar is true. But if the window width is <= 800, then the showSideBar becomes false.
Now that the value of showSideBar is false the value of showSideBar attribute in main element should change to false.
But it doesn't change