优化空状态图片样式

This commit is contained in:
2025-12-04 14:10:40 +08:00
parent 61b7309c32
commit b3315177dd
4 changed files with 24 additions and 4 deletions

View File

@@ -11,25 +11,39 @@ interface IProps {
wrapperHeight?: string;
width?: string;
height?: string;
scale?: string;
}
const ListLoadError = (props: IProps) => {
const { reload, text, errorImg, btnText, btnImg, wrapperHeight="", width = "", height = "" } = props;
const {
reload,
text,
errorImg,
btnText,
btnImg,
wrapperHeight = "",
width = "",
height = "",
scale = "",
} = props;
const handleReload = () => {
reload && typeof reload === "function" && reload();
};
return (
<View className={styles.listLoadError} style={{height: wrapperHeight}}>
<View className={styles.listLoadError} style={{ height: wrapperHeight }}>
<Image
className={styles.listLoadErrorImg}
style={{ width, height }}
style={{ width, height, transform: `scale(${scale})` }}
src={errorImg ? img[errorImg] : img.ICON_LIST_LOAD_ERROR}
/>
{text && <Text className={styles.listLoadErrorText}>{text}</Text>}
{reload && (
<View className={styles.listLoadErrorBtn} onClick={handleReload}>
<Image src={btnImg ? img[btnImg] : img?.ICON_LIST_RELOAD} className={styles.reloadIcon} />
<Image
src={btnImg ? img[btnImg] : img?.ICON_LIST_RELOAD}
className={styles.reloadIcon}
/>
{btnText ? " " + btnText : "重试"}
</View>
)}