O componente PageAside é um elemento <aside> fixo que só é exibido a partir do breakpoint lg.
--ui-header-height para se posicionar corretamente abaixo do Header.Use-o dentro do slot left ou right do componente Page:
<template>
<NPage>
<template #left>
<NPageAside />
</template>
</NPage>
</template>
Use o componente PageAside em um layout para exibir a navegação:
<script setup lang="ts">
import type { ContentNavigationItem } from '@nuxt/content'
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
</script>
<template>
<NPage>
<template #left>
<NPageAside>
<NContentNavigation :navigation="navigation" />
</NPageAside>
</template>
<slot />
</NPage>
</template>
ContentNavigation para exibir a navegação injetada em app.vue.| Prop | Default | Type |
|---|---|---|
as | 'aside' | anyThe element or component this component should render as. |
ui | { root?: SlotClass; container?: SlotClass; top?: SlotClass; topHeader?: SlotClass; topBody?: SlotClass; topFooter?: SlotClass; } |
| Slot | Type |
|---|---|
top | {} |
default | {} |
bottom | {} |
export default defineAppConfig({
ui: {
pageAside: {
slots: {
root: 'hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5',
container: 'relative',
top: 'sticky -top-8 -mt-8 pointer-events-none z-[1]',
topHeader: 'h-8 bg-default -mx-4 px-4',
topBody: 'bg-default relative pointer-events-auto flex flex-col -mx-4 px-4',
topFooter: 'h-8 bg-gradient-to-b from-default -mx-4 px-4'
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nitro/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
pageAside: {
slots: {
root: 'hidden overflow-y-auto lg:block lg:max-h-[calc(100vh-var(--ui-header-height))] lg:sticky lg:top-(--ui-header-height) py-8 lg:ps-4 lg:-ms-4 lg:pe-6.5',
container: 'relative',
top: 'sticky -top-8 -mt-8 pointer-events-none z-[1]',
topHeader: 'h-8 bg-default -mx-4 px-4',
topBody: 'bg-default relative pointer-events-auto flex flex-col -mx-4 px-4',
topFooter: 'h-8 bg-gradient-to-b from-default -mx-4 px-4'
}
}
}
})
]
})