diff --git a/src/api/global-api.md b/src/api/global-api.md index f31af42c88..6dd87bd63a 100644 --- a/src/api/global-api.md +++ b/src/api/global-api.md @@ -130,6 +130,17 @@ const MyComponent = defineComponent({ }) ``` +Or a `setup` function, function name will be used as component name + +```js +import { defineComponent, ref } from 'vue' + +const HelloWorld = defineComponent(function HelloWorld() { + const count = ref(0) + return { count } +}) +``` + ## defineAsyncComponent Creates an async component that will be loaded only when it's necessary.