We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayBase.Remove = React.forwardRef((props, ref) => { const index = useIndex(props.index) const self = useField() const array = useArray() const prefixCls = usePrefixCls('formily-array-base') if (!array) return null if (array.field?.pattern !== 'editable') return null return ( <Button ref={ref} type="text" {...props} disabled={self?.disabled} className={cls( ${prefixCls}-remove, self?.disabled ? ${prefixCls}-remove-disabled : '', props.className )} onClick={(e) => { if (self?.disabled) return e.stopPropagation() if (props.onClick) { props.onClick(e) if (e.defaultPrevented) return } console.log('remove inner', index); array.field?.remove?.(index!) array.props?.onRemove?.(index!) }} > {isUndef(props.prefix) ? : props.prefix} {props.title || self.title} ) })
${prefixCls}-remove
${prefixCls}-remove-disabled
<SchemaField.Array name="string_array" title="字符串数组" x-decorator="FormItem" x-component="ArrayItems" x-component-props={{ onRemove: (index) => { console.log('remove effet', index); } }} > <SchemaField.Void> <SchemaField.Void x-decorator="FormItem" x-component="ArrayItems.SortHandle" /> <SchemaField.String x-decorator="FormItem" required name="input" x-component="Input" /> <SchemaField.Void x-decorator="FormItem" x-component="ArrayItems.Remove" /> <SchemaField.Void x-decorator="FormItem" x-component="ArrayItems.Copy" /> </SchemaField.Void> <SchemaField.Void x-component="ArrayItems.Addition" title="添加条目" /> </SchemaField.Array>
点击删除,关联 item 被销毁
点击删除,关联 item 仍然存在
@formily/react@2.2.23
The text was updated successfully, but these errors were encountered:
I met the same issue, could you please how you solved it? @liuguibin0828
Sorry, something went wrong.
No branches or pull requests
Reproduction link
Steps to reproduce
ArrayBase.Remove = React.forwardRef((props, ref) => {
const index = useIndex(props.index)
const self = useField()
const array = useArray()
const prefixCls = usePrefixCls('formily-array-base')
if (!array) return null
if (array.field?.pattern !== 'editable') return null
return (
<Button
ref={ref}
type="text"
{...props}
disabled={self?.disabled}
className={cls(
${prefixCls}-remove
,self?.disabled ?
${prefixCls}-remove-disabled
: '',props.className
)}
onClick={(e) => {
if (self?.disabled) return
e.stopPropagation()
if (props.onClick) {
props.onClick(e)
if (e.defaultPrevented) return
}
console.log('remove inner', index);
array.field?.remove?.(index!)
array.props?.onRemove?.(index!)
}}
>
{isUndef(props.prefix) ? : props.prefix}
{props.title || self.title}
)
})
<SchemaField.Array
name="string_array"
title="字符串数组"
x-decorator="FormItem"
x-component="ArrayItems"
x-component-props={{
onRemove: (index) => {
console.log('remove effet', index);
}
}}
>
<SchemaField.Void>
<SchemaField.Void
x-decorator="FormItem"
x-component="ArrayItems.SortHandle"
/>
<SchemaField.String
x-decorator="FormItem"
required
name="input"
x-component="Input"
/>
<SchemaField.Void
x-decorator="FormItem"
x-component="ArrayItems.Remove"
/>
<SchemaField.Void
x-decorator="FormItem"
x-component="ArrayItems.Copy"
/>
</SchemaField.Void>
<SchemaField.Void
x-component="ArrayItems.Addition"
title="添加条目"
/>
</SchemaField.Array>
What is expected?
点击删除,关联 item 被销毁
What is actually happening?
点击删除,关联 item 仍然存在
Package
@formily/react@2.2.23
The text was updated successfully, but these errors were encountered: