본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

페이지 본문

원문 보기 위키 갱신

페이지 본문 (PageBody)

페이지 본문(PageBody)은 페이지의 메인 콘텐츠를 감싸고 일관된 간격을 위한 패딩을 더해주는 컴포넌트예요. Page 레이아웃에서 PageHeader 다음에 배치해 본문 영역을 구성해요.

출처: Nuxt UI

본문

페이지의 메인 콘텐츠를 담는 컴포넌트예요.

사용법 (Usage)

PageBody 컴포넌트는 메인 콘텐츠를 감싸고 일관된 간격을 위해 패딩을 더해줘요.

Page 컴포넌트의 기본 슬롯 안에서, PageHeader 컴포넌트 다음에 사용해요:

<template>
  <UPage>
    <UPageHeader />

    <UPageBody />
  </UPage>
</template>

예시 (Examples)

[!NOTE]

이 예시들은 Nuxt Content를 사용하지만, 컴포넌트는 어떤 콘텐츠 관리 시스템과도 연동할 수 있어요.

페이지 안에서

페이지에서 PageBody 컴포넌트를 사용해 페이지의 콘텐츠를 표시해요:

<script setup lang="ts">
const route = useRoute()

definePageMeta({
  layout: 'docs'
})

const { data: page } = await useAsyncData(route.path, () => {
  return queryCollection('docs').path(route.path).first()
})

const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
  return queryCollectionItemSurroundings('content', route.path)
})
</script>

<template>
  <UPage>
    <UPageHeader :title="page.title" :description="page.description" />

    <UPageBody>
      <ContentRenderer :value="page" />

      <USeparator />

      <UContentSurround :surround="surround" />
    </UPageBody>

    <template #right>
      <UContentToc :links="page.body.toc.links" />
    </template>
  </UPage>
</template>

[!NOTE]

이 예시에서는 @nuxt/content의 ContentRenderer 컴포넌트를 사용해 페이지 콘텐츠를 렌더링해요.

API

Props

/**
 * Props for the PageBody component
 */
interface PageBodyProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  ui?: { base?: any; } | undefined;
}

Slots

/**
 * Slots for the PageBody component
 */
interface PageBodySlots {
  default(): any;
}

테마 (Theme)

export default defineAppConfig({
  ui: {
    pageBody: {
      base: 'mt-8 pb-24 space-y-12'
    }
  }
})

변경 기록 (Changelog)

컴포넌트와 테마의 커밋 히스토리를 확인해 보세요.

더 알아보기 (Learn more)