Skip to content

Commit b3d7b6a

Browse files
authored
add usage that pass setup function to defineComponent (#455)
1 parent 92dbceb commit b3d7b6a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/api/global-api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ const MyComponent = defineComponent({
130130
})
131131
```
132132

133+
Or a `setup` function, function name will be used as component name
134+
135+
```js
136+
import { defineComponent, ref } from 'vue'
137+
138+
const HelloWorld = defineComponent(function HelloWorld() {
139+
const count = ref(0)
140+
return { count }
141+
})
142+
```
143+
133144
## defineAsyncComponent
134145

135146
Creates an async component that will be loaded only when it's necessary.

0 commit comments

Comments
 (0)