File tree Expand file tree Collapse file tree 2 files changed +24
-21
lines changed
packages/anu-vue/src/components/list Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import type { ExtractPropTypes } from 'vue'
33import type { ListPropItems } from ' ./props'
44import { listProps } from ' ./props'
55import type { listSlots } from ' ./slots'
6- import { listItemSlot } from ' ./slots'
6+ import { listItemSlots } from ' ./slots'
77import { isObject } from ' @/utils/helpers'
88import { useGroupModel } from ' @/composables'
99import { AListItem } from ' @/components/list-item'
@@ -70,12 +70,11 @@ const handleListItemClick = (item: ListPropItems[number]) => {
7070 >
7171 <!-- ℹ️ Recursively pass down slots to child -->
7272 <template
73- v-for =" name in Object . keys ( listItemSlot ) "
74- #[name ]=" slotProps "
73+ v-for =" { originalKey: originalSlotName , prefixedKey: updatedSlotName } in listItemSlots "
74+ #[originalSlotName ]=" slotProps "
7575 >
76- <!-- ℹ️ v-if condition will omit passing slots. Here, we don't want to pass default slot. -->
7776 <slot
78- :name =" name "
77+ :name =" updatedSlotName "
7978 :index =" index"
8079 v-bind =" slotProps || {}"
8180 />
Original file line number Diff line number Diff line change 11import type { ListPropItems } from './props'
2- import { listItemSlots } from '@/components/list-item/slots'
2+ import { listItemSlots as listItemComponentSlots } from '@/components/list-item/slots'
3+ import { prefixObjectKeys } from '@/utils/helpers'
34
45export const listOwnSlots = {
56 before : { } ,
@@ -9,22 +10,25 @@ export const listOwnSlots = {
910 after : { } ,
1011} as const
1112
12- export const listItemSlot = {
13- 'item-prepend' : {
14- item : listItemSlots . prepend . item ,
15- index : Number ( ) ,
16- } ,
17- 'item-item' : {
18- item : listItemSlots . item . item ,
19- index : Number ( ) ,
20- } ,
21- 'item-append' : {
22- item : listItemSlots . append . item ,
23- index : Number ( ) ,
24- } ,
25- } as const
13+ // export const listItemSlots = {
14+ // 'item-prepend': {
15+ // item: listItemComponentSlots.prepend.item,
16+ // index: Number(),
17+ // },
18+ // 'item-item': {
19+ // item: listItemComponentSlots.item.item,
20+ // index: Number(),
21+ // },
22+ // 'item-append': {
23+ // item: listItemComponentSlots.append.item,
24+ // index: Number(),
25+ // },
26+ // } as const
27+
28+ const { 'item-default' : _ , ...listItemSlots } = prefixObjectKeys ( listItemComponentSlots , 'item-' )
29+ export { listItemSlots }
2630
2731export const listSlots = {
28- ...listItemSlot ,
32+ ...listItemSlots ,
2933 ...listOwnSlots ,
3034} as const
You can’t perform that action at this time.
0 commit comments