perf: resolve duplicate component names (#6039)

This commit is contained in:
ming4762 2025-04-27 22:02:38 +08:00 committed by GitHub
parent 7c7051a11e
commit baec89f896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 82 additions and 40 deletions

View File

@ -136,20 +136,34 @@ async function initComponentAdapter() {
// 如果你的组件体积比较大,可以使用异步加载 // 如果你的组件体积比较大,可以使用异步加载
// Button: () => // Button: () =>
// import('xxx').then((res) => res.Button), // import('xxx').then((res) => res.Button),
ApiSelect: withDefaultPlaceholder(ApiComponent, 'select', { ApiSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiSelect',
},
'select',
{
component: Select, component: Select,
loadingSlot: 'suffixIcon', loadingSlot: 'suffixIcon',
visibleEvent: 'onDropdownVisibleChange', visibleEvent: 'onDropdownVisibleChange',
modelPropName: 'value', modelPropName: 'value',
}), },
ApiTreeSelect: withDefaultPlaceholder(ApiComponent, 'select', { ),
ApiTreeSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiTreeSelect',
},
'select',
{
component: TreeSelect, component: TreeSelect,
fieldNames: { label: 'label', value: 'value', children: 'children' }, fieldNames: { label: 'label', value: 'value', children: 'children' },
loadingSlot: 'suffixIcon', loadingSlot: 'suffixIcon',
modelPropName: 'value', modelPropName: 'value',
optionsPropName: 'treeData', optionsPropName: 'treeData',
visibleEvent: 'onVisibleChange', visibleEvent: 'onVisibleChange',
}), },
),
AutoComplete, AutoComplete,
Checkbox, Checkbox,
CheckboxGroup, CheckboxGroup,

View File

@ -184,19 +184,33 @@ async function initComponentAdapter() {
// 如果你的组件体积比较大,可以使用异步加载 // 如果你的组件体积比较大,可以使用异步加载
// Button: () => // Button: () =>
// import('xxx').then((res) => res.Button), // import('xxx').then((res) => res.Button),
ApiSelect: withDefaultPlaceholder(ApiComponent, 'select', { ApiSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiSelect',
},
'select',
{
component: ElSelectV2, component: ElSelectV2,
loadingSlot: 'loading', loadingSlot: 'loading',
visibleEvent: 'onVisibleChange', visibleEvent: 'onVisibleChange',
}), },
ApiTreeSelect: withDefaultPlaceholder(ApiComponent, 'select', { ),
ApiTreeSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiTreeSelect',
},
'select',
{
component: ElTreeSelect, component: ElTreeSelect,
props: { label: 'label', children: 'children' }, props: { label: 'label', children: 'children' },
nodeKey: 'value', nodeKey: 'value',
loadingSlot: 'loading', loadingSlot: 'loading',
optionsPropName: 'data', optionsPropName: 'data',
visibleEvent: 'onVisibleChange', visibleEvent: 'onVisibleChange',
}), },
),
Checkbox: ElCheckbox, Checkbox: ElCheckbox,
CheckboxGroup: (props, { attrs, slots }) => { CheckboxGroup: (props, { attrs, slots }) => {
let defaultSlot; let defaultSlot;

View File

@ -131,11 +131,24 @@ async function initComponentAdapter() {
// Button: () => // Button: () =>
// import('xxx').then((res) => res.Button), // import('xxx').then((res) => res.Button),
ApiSelect: withDefaultPlaceholder(ApiComponent, 'select', { ApiSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiSelect',
},
'select',
{
component: NSelect, component: NSelect,
modelPropName: 'value', modelPropName: 'value',
}), },
ApiTreeSelect: withDefaultPlaceholder(ApiComponent, 'select', { ),
ApiTreeSelect: withDefaultPlaceholder(
{
...ApiComponent,
name: 'ApiTreeSelect',
},
'select',
{
component: NTreeSelect, component: NTreeSelect,
nodeKey: 'value', nodeKey: 'value',
loadingSlot: 'arrow', loadingSlot: 'arrow',
@ -143,7 +156,8 @@ async function initComponentAdapter() {
modelPropName: 'value', modelPropName: 'value',
optionsPropName: 'options', optionsPropName: 'options',
visibleEvent: 'onVisibleChange', visibleEvent: 'onVisibleChange',
}), },
),
Checkbox: NCheckbox, Checkbox: NCheckbox,
CheckboxGroup: (props, { attrs, slots }) => { CheckboxGroup: (props, { attrs, slots }) => {
let defaultSlot; let defaultSlot;