CreateComponent
Component utility.
Basic Usage
loading
Component Not Found Display
loading
Set Properties
loading
Set Slots
loading
Nesting
loading
Options
loading
Register Components On Demand
js
// Global registration
registerComponent({
demo: ElInput,
});
// If only temporary use
const config = {
component: ElInput,
};
// Function component switching mainly targets list usage. For normal use, just modify the component value directly
loading
Uniformly Set Properties
js
Registration priority: default registration in UI library < project registration < component config registration < component property registration;
registerComponentDefaultPropsMap({
demo: {
placeholder: 'placeholder test',
},
});
loading
Uniformly Set Slots
js
registerComponentDefaultSlotsMap({
demo: {
append: 'append',
},
});
loading
Uniformly Set Events
js
registerComponentDefaultEventsMap({
input: {
onClick: () => {
console.log('click');
},
},
});
loading
Props
Prop | Description | Type | Default |
---|---|---|---|
config | Component generation configuration | Config | None |
emptyText | String displayed when component not found | String | None |
Config
Prop | Description | Type | Required |
---|---|---|---|
component | Registered component key | string | ComponentFunctionType | Yes |
props | Component properties or events | Record<string, any> | No |
children | Nested Config | string | string[] | Config[] | No |
slots | Component slots | Record<string, string | number | VNode | (string | number | VNode)[]> | No |