diff --git a/src/components/Upload/src/FileList.tsx b/src/components/Upload/src/FileList.tsx index c7d61a5c5911e0724d32d588fb700b48ab0c9d72..4137537b4e70b1b17e3d623a14f7dd81ce52d7d8 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]} + + ); })} );