ComponentEmits
:component-emits line. Event names, parameter signatures and JSDoc descriptions come from the defineEmits type and complete the API docs next to the props and slots tables.ComponentEmits reads a component's defineEmits type and renders each event's name, parameter signature and description.
Usage
| Event | Type |
|---|---|
change | [value: string](event: "change", value: string): void值变化时触发 |
delete | [](event: "delete"): void删除时触发 |
:component-emits{slug="TestApi"}
Without slug, the component is resolved from the last segment of the current route.
Documenting events
Declare events with the named tuple syntax and add JSDoc to each one. At build time the layer parses these comments from the source to fill in the event descriptions that vue-component-meta cannot read:
<script setup lang="ts">
defineEmits<{
/**
* Emitted when the value changes
* @see https://vuejs.org/guide/components/events.html
*/
change: [value: string]
/**
* Emitted on delete
*/
delete: []
}>()
</script>
API
Props
| Prop | Default | Type |
|---|---|---|
slug | 路由路径的最后一段 | string获取组件事件的 slug 标识 |
Changelog
ComponentSlots
List every slot of a Vue component with a single `:component-slots` line. Slot names, scoped parameter types and JSDoc descriptions come from the `defineSlots` type, so there is nothing to write by hand.
ComponentExample
Render a Vue file from the examples directory as a live preview with its highlighted source below. Supports line highlights, collapsing, adjustable options and client-only rendering for showing components in realistic compositions.