x-render icon indicating copy to clipboard operation
x-render copied to clipboard

upload 组件其他属性无法使用

Open bingege12138 opened this issue 3 years ago • 1 comments

1.依赖仓库的版本(Dependencies versions)

  • react:"^16.7.0"
  • form-render:"^1.13.11"
  • table-render:
  • antd:^4.16.6

2.问题描述(Bug description): upload 无法使用antd 自带的其他属性

代码 const elements = [ { text: '附件', name: 'UploadFile', schema: { title: '附件', type: 'string', widget: "UploadFile", props: { action: '/api/v1/appraisal/settlement_order/uploadReceipt', headers: { Authorization: window.localStorage.Authorization || "" }, } }, setting: { }, }, ];

form-render demo https://codesandbox.io/s/unruffled-flower-jl78h table-render demo https://codesandbox.io/s/sweet-euler-bdoty fr-generator demo https://codesandbox.io/s/s13sh

bingege12138 avatar Aug 10 '22 07:08 bingege12138

可以自己基于upload组件外面包裹一层,通过schema的props把需要的属性传进去,然后解析出来挂载upload组件上

const uploadWrap = (props) => {
    {onchange, ...otherProps} = props;
    <Upload {...otherProps}/>
}

shinneyou avatar Aug 11 '22 07:08 shinneyou

好的谢谢

bingege12138 avatar Aug 16 '22 09:08 bingege12138

@shinneyou 这个包装的组件是作为自定义组件加在widgets属性中吗?怎么去使用呢?

iceberg211 avatar Aug 23 '22 10:08 iceberg211