setupJsdoc
Stability:
stableDefine the component's JSDoc in the script setup block.
| Features | Supported |
|---|---|
| Volar Plugin | ✅ |
Basic Usage
vue
<script setup lang="tsx">
import Comp from './Comp.vue'
</script>
<template>
<Comp />
</template>There are two places to define
- The first line of the script setup block.
vue
<script setup lang="ts">
/**
* @example
* ```vue
* <Comp :foo="1" />
* ```
*/
defineProps<{
foo: number
}>()
</script>- Above the
export defaultexpression.
TIP
This feature depends on exportRender, and make sure exportRender is not disabled.
vue
<script setup lang="tsx">
defineProps<{
foo: number
}>()
/**
* @example
* ```vue
* <Comp :foo="1" />
* ```
*/
export default <div />
</script>Volar Configuration
jsonc
{
"vueCompilerOptions": {
"plugins": ["vue-macros/volar"],
},
}
Kevin Deng
zhiyuanzmj
Leo