Skip to content

Commit e3da7bc

Browse files
add resolveDynamicComponent to global api (#280)
* add resolveDynamicComponent * captalize section link Co-authored-by: Natalia Tepluhina <[email protected]> Co-authored-by: Natalia Tepluhina <[email protected]>
1 parent baf74be commit e3da7bc

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

src/api/global-api.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const AsyncComp = defineAsyncComponent({
196196
## resolveComponent
197197

198198
:::warning
199-
`resolveComponent` can only be used within render functions.
199+
`resolveComponent` can only be used within `render` or `setup` functions.
200200
:::
201201

202202
Allows resolving a `component` by its name, if it is available in the current application instance.
@@ -229,10 +229,39 @@ Accepts one argument: `component`
229229

230230
The name of a loaded component.
231231

232+
## resolveDynamicComponent
233+
234+
:::warning
235+
`resolveDynamicComponent` can only be used within `render` or `setup` functions.
236+
:::
237+
238+
Allows resolving a `component` by the same mechanism that `<component :is="">` employs.
239+
240+
Returns the resolved `Component` or a newly created `VNode` with the component name as the node tag. Will raise a warning if the `Component` was not found.
241+
242+
```js
243+
import { resolveDynamicComponent } from 'vue'
244+
render () {
245+
const MyComponent = resolveDynamicComponent('MyComponent')
246+
}
247+
```
248+
249+
### Arguments
250+
251+
Accepts one argument: `component`
252+
253+
#### component
254+
255+
- **Type:** `String | Object (component’s options object)`
256+
257+
- **Details:**
258+
259+
For more details, refer to the documentation on [Dynamic Components](../guide/component-dynamic-async.html).
260+
232261
## resolveDirective
233262

234263
:::warning
235-
`resolveDirective` can only be used within render functions.
264+
`resolveDirective` can only be used within `render` or `setup` functions.
236265
:::
237266

238267
Allows resolving a `directive` by its name, if it is available in the current application instance.
@@ -266,7 +295,7 @@ Accepts one argument: `name`
266295
## withDirectives
267296

268297
:::warning
269-
`withDirectives` can only be used within render functions.
298+
`withDirectives` can only be used within `render` or `setup` functions.
270299
:::
271300

272301
Allows applying directives to a **VNode**. Returns a VNode with the applied directives.

0 commit comments

Comments
 (0)