Skip to content

Commit

Permalink
feat(ArrayBase): support use $record/$index expression scope for Arra…
Browse files Browse the repository at this point in the history
…yBase
  • Loading branch information
cn-xufei committed Dec 8, 2023
1 parent 0c0ed3b commit fe983bf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/components/src/array-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import {
PropType,
h,
} from 'vue'
import { FragmentComponent, useField, useFieldSchema } from '@formily/vue'
import {
ExpressionScope,
FragmentComponent,
useField,
useFieldSchema,
} from '@formily/vue'
import { isValid, uid, clone } from '@formily/shared'
import { ArrayField } from '@formily/core'
import type { ButtonProps as ElButtonProps } from 'element-plus'
Expand Down Expand Up @@ -171,7 +176,13 @@ const ArrayBaseItem = defineComponent({
setup(props: IArrayBaseItemProps, { slots }) {
provide(ItemSymbol, props)
return () => {
return h(FragmentComponent, {}, slots)
return h(
ExpressionScope,
{ value: { $record: props.record, $index: props.index } },
{
default: () => h(FragmentComponent, {}, slots),
}
)
}
},
})
Expand Down

0 comments on commit fe983bf

Please sign in to comment.