fix(移动端-框架): 附件删除(删除不掉) (#1574)
Reviewed-on: daoyoucloud/tachybase#1574 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
4b5d09a3cf
commit
5cb9529900
@ -7,6 +7,7 @@ import { ImageUploader, ImageUploadItem } from 'antd-mobile';
|
|||||||
export const MImageUploader = connect(
|
export const MImageUploader = connect(
|
||||||
(props) => {
|
(props) => {
|
||||||
const [fileList, setFileList] = useState<ImageUploadItem[]>([]);
|
const [fileList, setFileList] = useState<ImageUploadItem[]>([]);
|
||||||
|
|
||||||
const [change, setChange] = useState(false);
|
const [change, setChange] = useState(false);
|
||||||
const field = props.value || [];
|
const field = props.value || [];
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -47,6 +48,11 @@ export const MImageUploader = connect(
|
|||||||
setChange(true);
|
setChange(true);
|
||||||
props.onChange(field);
|
props.onChange(field);
|
||||||
}}
|
}}
|
||||||
|
onDelete={(file) => {
|
||||||
|
const fileIndex = field.findIndex((item) => item.id === file.key);
|
||||||
|
field.splice(fileIndex, 1);
|
||||||
|
props.onChange(field);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user