Commit e59ad734 by zhaochengxiang

列宽调整

parent 503a1331
......@@ -126,6 +126,7 @@ const AssetTable = (props) => {
const [ loading, setLoading ] = useState(false);
const [ columns, setColumns ] = useState([]);
const [ realColumns, setRealColumns ] = useState([]);
const [ assets, setAssets ] = useState([]);
const [ total, setTotal ] = useState(0);
const [ selectItem, setSelectItem ] = useState({});
......@@ -158,7 +159,7 @@ const AssetTable = (props) => {
const metadataIndexRef = useRef('');
const remoteRelationRef = useRef(null);
const realColumns = useMemo(() => {
useEffect(() => {
if (TableWidth>0 && columns.length>0) {
const currentWidth = (columns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 32.0;
......@@ -168,10 +169,11 @@ const AssetTable = (props) => {
})
}
return ([...columns, <Column key='auto' />]);
setRealColumns([...columns, <Column key='auto' />]);
} else {
setRealColumns([]);
}
return [];
}, [columns, TableWidth])
useEffect(() => {
......@@ -687,13 +689,13 @@ const AssetTable = (props) => {
}
const handleResize = index => (e, { size }) => {
const nextColumns = [...columns];
const nextColumns = [...realColumns];
nextColumns[index] = {
...nextColumns[index],
width: size.width,
};
setColumns(nextColumns);
setRealColumns(nextColumns);
};
const displayMenu = (e) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment