Main
사용 가능한 뷰포트 높이만큼 채우는 <main> 요소 컴포넌트예요. Header와 함께 쓰면 전체 높이 레이아웃을 쉽게 만들 수 있어요.
출처: Nuxt UI
본문
사용 가능한 뷰포트 높이를 채우는 <main> 요소 컴포넌트예요.
사용법
Main 컴포넌트는 <main> 요소를 렌더링하는데요, Header 컴포넌트와 함께 사용해서 뷰포트의 사용 가능한 높이까지 채우는 전체 높이 레이아웃을 만들어요.
[!TIP] See: /docs/getting-started/theme/css-variables#header
The Main component uses the
--ui-header-heightCSS variable to position itself correctly below theHeader.
Main 컴포넌트는 --ui-header-height CSS 변수를 사용해서 Header 아래에 올바르게 위치해요.
예시 (Examples)
app.vue 안에서 (Within app.vue)
app.vue나 레이아웃에서 Main 컴포넌트를 사용해요:
<template>
<UApp>
<UHeader />
<UMain>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</UMain>
<UFooter />
</UApp>
</template>
API
Props
/**
* Props for the Main component
*/
interface MainProps {
/**
* The element or component this component should render as.
* @default 'main'
*/
as?: any;
ui?: { base?: any; } | undefined;
}
Slots
/**
* Slots for the Main component
*/
interface MainSlots {
default(): any;
}
테마 (Theme)
export default defineAppConfig({
ui: {
main: {
base: 'min-h-[calc(100vh-var(--ui-header-height))]'
}
}
})