2023-10-15 20:57:44 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
2023-10-15 21:00:28 +00:00
|
|
|
<p>The components to import and register are defined with the <i>include</i> option using a string array. When the value is ignored or set using the <i>*</i> alias, all of the components are registered.</p>
|
2024-01-30 08:16:35 +00:00
|
|
|
<DocSectionCode :code="code1" importCode hideToggleCode hideStackBlitz />
|
2023-10-15 21:00:28 +00:00
|
|
|
<p>In case all components are imported, particular components can still be excluded with the <i>exclude</i> option.</p>
|
2024-01-30 08:16:35 +00:00
|
|
|
<DocSectionCode :code="code2" importCode hideToggleCode hideStackBlitz />
|
2024-04-14 16:32:03 +00:00
|
|
|
<p>By default, for compatibility reasons, Chart and Editor components are excluded. To include them simply set the <i>exclude</i> option to an empty list.</p>
|
2024-01-30 08:16:35 +00:00
|
|
|
<DocSectionCode :code="code3" importCode hideToggleCode hideStackBlitz />
|
2024-04-14 16:32:03 +00:00
|
|
|
<p>Use the <i>prefix</i> option to give a prefix to the registered component names.</p>
|
|
|
|
<DocSectionCode :code="code4" importCode hideToggleCode hideStackBlitz />
|
2023-10-15 20:57:44 +00:00
|
|
|
<p>
|
2023-10-15 21:00:28 +00:00
|
|
|
Component registration can be customized further by implementing the <i>name</i> function that gets an object representing the import metadata. <i>name</i> is the label of the component, <i>as</i> is the default export name and
|
|
|
|
<i>from</i> is the import path.
|
2023-10-15 20:57:44 +00:00
|
|
|
</p>
|
2024-04-14 16:32:03 +00:00
|
|
|
<DocSectionCode :code="code5" importCode hideToggleCode hideStackBlitz />
|
2023-10-15 20:57:44 +00:00
|
|
|
</DocSectionText>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
code1: {
|
|
|
|
basic: `
|
2023-10-16 08:10:39 +00:00
|
|
|
primevue: {
|
2023-10-15 20:57:44 +00:00
|
|
|
components: {
|
|
|
|
include: ['Button', 'DataTable']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
},
|
|
|
|
code2: {
|
|
|
|
basic: `
|
2023-10-16 08:10:39 +00:00
|
|
|
primevue: {
|
2023-10-15 20:57:44 +00:00
|
|
|
components: {
|
|
|
|
include: '*',
|
|
|
|
exclude: ['Galleria', 'Carousel']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
},
|
|
|
|
code3: {
|
|
|
|
basic: `
|
2024-04-14 16:32:03 +00:00
|
|
|
primevue: {
|
|
|
|
components: {
|
|
|
|
exclude: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
},
|
|
|
|
code4: {
|
|
|
|
basic: `
|
2023-10-16 08:10:39 +00:00
|
|
|
primevue: {
|
2023-10-15 20:57:44 +00:00
|
|
|
components: {
|
|
|
|
prefix: 'Prime'
|
2023-10-16 08:10:39 +00:00
|
|
|
include: ['Button', 'DataTable'] /* Used as <PrimeButton /> and <PrimeDataTable /> */
|
2023-10-15 20:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
},
|
2024-04-14 16:32:03 +00:00
|
|
|
code5: {
|
2023-10-15 20:57:44 +00:00
|
|
|
basic: `
|
2023-10-16 08:10:39 +00:00
|
|
|
primevue: {
|
2023-10-15 20:57:44 +00:00
|
|
|
components: {
|
2023-10-16 08:10:39 +00:00
|
|
|
name: ({ name, as, from }) => {
|
2023-10-15 20:57:44 +00:00
|
|
|
return name === 'Button' ? \`My\${name}\` : name;
|
2023-10-25 03:17:40 +00:00
|
|
|
},
|
2023-10-15 20:57:44 +00:00
|
|
|
include: ['Button', 'DataTable'] /* Used as <MyButton /> and <DataTable /> */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
2023-10-15 21:00:28 +00:00
|
|
|
};
|
2023-10-15 20:57:44 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|