Commit e59ad734 by zhaochengxiang

列宽调整

parent 503a1331
...@@ -126,6 +126,7 @@ const AssetTable = (props) => { ...@@ -126,6 +126,7 @@ const AssetTable = (props) => {
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
const [ columns, setColumns ] = useState([]); const [ columns, setColumns ] = useState([]);
const [ realColumns, setRealColumns ] = useState([]);
const [ assets, setAssets ] = useState([]); const [ assets, setAssets ] = useState([]);
const [ total, setTotal ] = useState(0); const [ total, setTotal ] = useState(0);
const [ selectItem, setSelectItem ] = useState({}); const [ selectItem, setSelectItem ] = useState({});
...@@ -158,7 +159,7 @@ const AssetTable = (props) => { ...@@ -158,7 +159,7 @@ const AssetTable = (props) => {
const metadataIndexRef = useRef(''); const metadataIndexRef = useRef('');
const remoteRelationRef = useRef(null); const remoteRelationRef = useRef(null);
const realColumns = useMemo(() => { useEffect(() => {
if (TableWidth>0 && columns.length>0) { if (TableWidth>0 && columns.length>0) {
const currentWidth = (columns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 32.0; const currentWidth = (columns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 32.0;
...@@ -168,10 +169,11 @@ const AssetTable = (props) => { ...@@ -168,10 +169,11 @@ const AssetTable = (props) => {
}) })
} }
return ([...columns, <Column key='auto' />]); setRealColumns([...columns, <Column key='auto' />]);
} else {
setRealColumns([]);
} }
return [];
}, [columns, TableWidth]) }, [columns, TableWidth])
useEffect(() => { useEffect(() => {
...@@ -687,13 +689,13 @@ const AssetTable = (props) => { ...@@ -687,13 +689,13 @@ const AssetTable = (props) => {
} }
const handleResize = index => (e, { size }) => { const handleResize = index => (e, { size }) => {
const nextColumns = [...columns]; const nextColumns = [...realColumns];
nextColumns[index] = { nextColumns[index] = {
...nextColumns[index], ...nextColumns[index],
width: size.width, width: size.width,
}; };
setColumns(nextColumns); setRealColumns(nextColumns);
}; };
const displayMenu = (e) => { 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