fix: modelscope api incorrect
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { DoubleRightOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Button } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
@@ -9,13 +12,38 @@ const InfiniteScroller: React.FC<
|
||||
UseInfiniteScrollOptions & { children: React.ReactNode }
|
||||
> = (props) => {
|
||||
const { children, ...restProps } = props;
|
||||
const { observerRef } = useInfiniteScroll(restProps);
|
||||
const intl = useIntl();
|
||||
const { observerRef, throttledLoadMore } = useInfiniteScroll(restProps);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{children}
|
||||
<div ref={observerRef} style={{ height: 1 }}>
|
||||
<span></span>
|
||||
<div
|
||||
ref={observerRef}
|
||||
style={{
|
||||
height: 1
|
||||
}}
|
||||
>
|
||||
{restProps.current < restProps.total && (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
marginTop: 24
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={throttledLoadMore}
|
||||
type="text"
|
||||
size="small"
|
||||
disabled={restProps.loading}
|
||||
>
|
||||
{intl.formatMessage({ id: 'common.button.more' })}
|
||||
<DoubleRightOutlined rotate={90} />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -45,5 +45,5 @@ export function useInfiniteScroll({
|
||||
}
|
||||
}, [inView, throttledLoadMore]);
|
||||
|
||||
return { observerRef };
|
||||
return { observerRef, throttledLoadMore };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user