---
title: "ComponentEmits"
description: "ComponentEmits automatically extracts a Vue component's defineEmits definitions via nuxt-component-meta, generating an Emits documentation table in your Markdown that includes event names, parameter types, and descriptions, with no need to write event API documentation by hand. Use it together with ComponentProps and ComponentSlots."
canonical_url: "https://docs.mhaibaraai.cn/en/docs/components/component-emits"
---
# ComponentEmits

> ComponentEmits automatically extracts a Vue component's defineEmits definitions via nuxt-component-meta, generating an Emits documentation table in your Markdown that includes event names, parameter types, and descriptions, with no need to write event API documentation by hand. Use it together with ComponentProps and ComponentSlots.

## Usage

Use the `:component-emits` syntax in your Markdown documentation:

```mdc
:component-emits{slug="TestApi"}
```

## API

### Props

```ts
/**
 * Props for the ComponentEmits component
 */
interface ComponentEmitsProps {
  /**
   * 获取组件事件的 slug 标识
   * @default 路由路径的最后一段
   */
  slug?: string | undefined;
}
```

## Changelog

See commit history for [layer/app/components/content/ComponentEmits.vue](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/app/components/content/ComponentEmits.vue).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/app/components/content/ComponentEmits.vue)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.cn/sitemap.md) for all pages.
