# Inline Citation

> 在正文中预览引用来源，确认后交给宿主导航。

网页来源：/components/inline-citation

版本：@quirekit/ui 0.3.1；源码修订：d79a6b48d00e+worktree。此文档对应当前源码构建，接入方式以开始使用为准。

接入前置：[开始使用](/raw/components/getting-started.md)（Vue、样式、主题与图标 Provider）。

`QuireInlineCitation` 用于文档或消息正文，默认以右上角的 `sup` 上标呈现，不额外撑高正文行。`label` 是短标记，`source` 是已解析的来源；缺失时保留标记并显示“来源不可用”。点击或键盘激活标记先打开预览，只有预览内的“查看来源”才发出 `navigate`，触屏不会直接跳走。

### 示例：inline-citation/basic

文件：`basic.vue`

```vue
<script setup lang="ts">
import { ref } from 'vue';
import { QuireInlineCitation, QuireProse } from '@quirekit/ui/vue';
import type { QuireKitSource, QuireKitSourceNavigateDetails } from '@quirekit/ui';

const source: QuireKitSource = {
  id: 'guide', title: '公共组件接入指南', label: 'QuireKit 文档',
  description: '展示类型与操作意图可以独立于消费者的业务协议。',
  quote: '来源导航由消费端执行。'
};
const result = ref('');
/** Echo an intent so the demo remains on the same page.
 * @param details - Selected source identity.
 */
function navigate(details: QuireKitSourceNavigateDetails): void {
  result.value = `已请求打开 ${details.sourceId}`;
}
</script>

<template>
  <div class="grid min-w-0 gap-qk-inline p-qk-surface" data-inline-citation-demo>
    <QuireProse>
      <p>组件只呈现来源，不替文档判断访问权限<QuireInlineCitation label="[1]" :source="source" @navigate="navigate" />；旧资源仍保留可检查的引用位置<QuireInlineCitation label="[2]" />。</p>
      <p>句末的依据也保持上标位置<QuireInlineCitation label="[3]" :source="source" @navigate="navigate" /></p>
    </QuireProse>
    <p v-if="result" class="m-0 text-qk-helper text-qk-text-secondary" role="status">{{ result }}</p>
  </div>
</template>
```

引用在结构化内容的位置由消费者决定。Markdown 文本不会被组件自动按数字或脚注语法拆分，资源的实际打开与权限检查也由宿主负责。

## API

### QuireInlineCitation

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| label | 是 | — | Stable citation number or short marker text. |
| source | 否 | — | Resolved source; absence renders an explicit unavailable preview. |

**label**

```ts
string
```

**source**

```ts
QuireKitSource | undefined
```

```ts
undefined | {
  /** Stable identity supplied by the host; it is not an array position. */
  id: string;
  /** Human-readable document or page title. */
  title: string;
  /** Optional origin, such as a host name or document collection. */
  label?: undefined | string;
  /** Short context shown in the expanded list and citation preview. */
  description?: string | undefined;
  /** Optional exact excerpt; never inferred from the answer text. */
  quote?: string | undefined;
  /** A host-owned address included in the intent, never opened by the component. */
  href?: string | undefined;
  /** Missing or inaccessible resources remain visible but cannot request navigation. */
  unavailable?: boolean | undefined;
}
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| navigate | 否 | — |  |

**navigate**

```ts
[details: QuireKitSourceNavigateDetails]
```

#### Slots

无。

#### 公开实例成员

无。

#### 相关类型

```ts
type QuireKitSource = {
  /** Stable identity supplied by the host; it is not an array position. */
  id: string;
  /** Human-readable document or page title. */
  title: string;
  /** Optional origin, such as a host name or document collection. */
  label?: undefined | string;
  /** Short context shown in the expanded list and citation preview. */
  description?: string | undefined;
  /** Optional exact excerpt; never inferred from the answer text. */
  quote?: string | undefined;
  /** A host-owned address included in the intent, never opened by the component. */
  href?: string | undefined;
  /** Missing or inaccessible resources remain visible but cannot request navigation. */
  unavailable?: boolean | undefined;
};
```
