For AI agents: the complete documentation index is available at https://a3s-lab.github.io/Office/docs/0.303.0/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/Office/docs/0.303.0/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/Office/docs/0.303.0/components/vue.md.

Vue

Vue 绑定与 React 使用相同的内容类型,并支持 v-model:content

DocumentPage.vue
<script setup lang="ts">
import { ref } from 'vue';
import type { DocumentContent } from '@a3s-lab/office/core';
import { DocumentEditor } from '@a3s-lab/office/vue';
import '@a3s-lab/office/styles.css';

const content = ref<DocumentContent>({
  type: 'document',
  html: '<h1>项目说明</h1><p>从这里开始编辑。</p>',
  pageSize: 'a4',
});
</script>

<template>
  <main class="editor-host">
    <DocumentEditor v-model:content="content" theme="light" />
  </main>
</template>

<style scoped>
.editor-host {
  height: 100vh;
  min-height: 0;
}
</style>

如果应用只使用事件,可以传入 :content="content",并通过 @change="content = $event" 接收新值。agent-request 等宿主回调仍保留 完整的类型化载荷。