From fb5395b5401b4b1f9e605d2721784482a76d49cc Mon Sep 17 00:00:00 2001 From: vben Date: Mon, 7 Dec 2020 22:26:25 +0800 Subject: [PATCH] fix(upload): fix file upload key loss #120 --- src/components/Upload/src/FileList.tsx | 37 ++++++++++++-------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/components/Upload/src/FileList.tsx b/src/components/Upload/src/FileList.tsx index c7d61a5c..4137537b 100644 --- a/src/components/Upload/src/FileList.tsx +++ b/src/components/Upload/src/FileList.tsx @@ -1,4 +1,4 @@ -import { defineComponent } from 'vue'; +import { defineComponent, CSSProperties } from 'vue'; import { fileListProps } from './props'; import { isFunction } from '/@/utils/is'; import './FileList.less'; @@ -16,11 +16,13 @@ export default defineComponent({ {columnList.map((item) => { const { width = 0, dataIndex } = item; - return width ? ( - - ) : ( - - ); + + const style: CSSProperties = { + width: `${width}px`, + minWidth: `${width}px`, + }; + + return ; })} @@ -38,22 +40,17 @@ export default defineComponent({ {dataSource.map((record = {}) => { return ( - + {columnList.map((item) => { const { dataIndex = '', customRender, align = 'center' } = item; - if (customRender && isFunction(customRender)) { - return ( - - {customRender({ text: record[dataIndex], record })} - - ); - } else { - return ( - - {record[dataIndex]} - - ); - } + const render = customRender && isFunction(customRender); + return ( + + {render + ? customRender?.({ text: record[dataIndex], record }) + : record[dataIndex]} + + ); })} ); -- GitLab