Astro에 통합하기

먼저 설치 및 기본 사용를 읽으십시오. 이 Astro 페이지는 고도를 가진 콘테이너로 Univer 널을 거치합니다.

일반 <script>에서 편집기를 초기화하여 브라우저에서 직접 실행합니다. astro:page-load의 첫 번째로드 및 다시 설정 실행하십시오. ClientRouter가 사용되면 astro:before-swap 이전에 편집기의 분해가 발생합니다. 편집기가 Astro frontmatter에서 가져옵니다. Astro 내비게이션 이벤트 참조 문서는 라이프 사이클을 참조합니다.

통합 단계

  1. mount() / astro:page-load에서 Univer를 초기화합니다.
  2. astro:before-swap에서 Univer를 해제합니다.

플러그인 설정

UniverUIPlugin

  • container
    string | HTMLElement
    편집기를 마운트할 DOM 요소 또는 해당 요소의 ID입니다.

UniverLicensePlugin

  • license
    string
    클라이언트 라이선스 파일의 내용입니다.

예제 코드

Astro
<div id="univer-boards" style="height: 600px"></div><script>  import { UniverBoardsPlugin } from '@univerjs-pro/boards'  import { UniverBoardsUIPlugin } from '@univerjs-pro/boards-ui'  import BoardsUIkoKR from '@univerjs-pro/boards-ui/locale/ko-KR'  import { UniverInkUIPlugin } from '@univerjs-pro/ink-ui'  import InkUIkoKR from '@univerjs-pro/ink-ui/locale/ko-KR'  import { UniverLicensePlugin } from '@univerjs-pro/license'  import { LocaleType, mergeLocales, Univer, UniverInstanceType } from '@univerjs/core'  import DesignkoKR from '@univerjs/design/locale/ko-KR'  import { UniverDocsPlugin } from '@univerjs/docs'  import { UniverDocsUIPlugin } from '@univerjs/docs-ui'  import DocsUIkoKR from '@univerjs/docs-ui/locale/ko-KR'  import { UniverDrawingPlugin } from '@univerjs/drawing'  import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui'  import DrawingUIkoKR from '@univerjs/drawing-ui/locale/ko-KR'  import { UniverRenderEnginePlugin } from '@univerjs/engine-render'  import { UniverUIPlugin } from '@univerjs/ui'  import UIkoKR from '@univerjs/ui/locale/ko-KR'  import '@univerjs/design/lib/index.css'  import '@univerjs/ui/lib/index.css'  import '@univerjs/docs-ui/lib/index.css'  import '@univerjs/drawing-ui/lib/index.css'  import '@univerjs-pro/ink-ui/lib/index.css'  import '@univerjs-pro/boards-ui/lib/index.css'  let univerInstance: Univer | undefined  function mount() {    const container = document.getElementById('univer-boards')    if (!container || univerInstance) return    const univer = new Univer({      locale: LocaleType.KO_KR,      locales: {        [LocaleType.KO_KR]: mergeLocales(          DesignkoKR,          UIkoKR,          DocsUIkoKR,          DrawingUIkoKR,          InkUIkoKR,          BoardsUIkoKR,        ),      },    })    univer.registerPlugin(UniverLicensePlugin, {      license: 'your license.txt',    })    univer.registerPlugin(UniverRenderEnginePlugin)    univer.registerPlugin(UniverUIPlugin, { container })    univer.registerPlugin(UniverDocsPlugin)    univer.registerPlugin(UniverDocsUIPlugin)    univer.registerPlugin(UniverDrawingPlugin)    univer.registerPlugin(UniverDrawingUIPlugin)    univer.registerPlugin(UniverInkUIPlugin)    univer.registerPlugin(UniverBoardsPlugin)    univer.registerPlugin(UniverBoardsUIPlugin)    univer.createUnit(UniverInstanceType.UNIVER_BOARD, {})    univerInstance = univer  }  function dispose() {    univerInstance?.dispose()    univerInstance = undefined  }  mount()  document.addEventListener('astro:page-load', mount)  document.addEventListener('astro:before-swap', dispose)</script>

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.