fix: do not init meta data when switch tab

This commit is contained in:
jialin
2025-03-05 20:30:53 +08:00
parent caadc02fb4
commit 4de1a38c00
11 changed files with 133 additions and 108 deletions
+38 -38
View File
@@ -7,8 +7,17 @@ const RenderProgress = memo(
steps?: number;
download?: boolean;
label?: React.ReactNode;
successPercent?: number;
successColor?: string;
}) => {
const { percent, steps = 5, download, label } = props;
const {
percent,
steps = 5,
download,
label,
successPercent,
successColor
} = props;
const strokeColor = useMemo(() => {
if (download) {
@@ -24,47 +33,38 @@ const RenderProgress = memo(
return 'var(--ant-color-error)';
}, [percent]);
const renderProgress = useMemo(() => {
return (
<Progress
percentPosition={{ align: 'center', type: 'inner' }}
size={[undefined, 16]}
format={() => {
return (
<span
style={{
color: '#fff'
}}
>
{percent}%
</span>
);
}}
percent={percent}
success={{
percent: successPercent,
strokeColor: 'var(--ant-geekblue-3)'
}}
strokeColor={strokeColor}
></Progress>
);
}, [percent, successPercent, strokeColor]);
return (
<>
{label ? (
<Tooltip title={label}>
<Progress
percentPosition={{ align: 'center', type: 'inner' }}
size={[undefined, 16]}
format={() => {
return (
<span
style={{
color: '#fff'
}}
>
{percent}%
</span>
);
}}
percent={percent}
strokeColor={strokeColor}
></Progress>
</Tooltip>
<Tooltip title={label}>{renderProgress}</Tooltip>
) : (
<Progress
type="line"
percentPosition={{ align: 'center', type: 'inner' }}
size={[undefined, 16]}
format={() => {
return (
<span
style={{
color: '#fff'
}}
>
{percent}%
</span>
);
}}
percent={percent}
strokeColor={strokeColor}
></Progress>
renderProgress
)}
</>
);