优化样式

This commit is contained in:
2025-10-04 11:42:20 +08:00
parent f6a1568719
commit 2dd634c921
9 changed files with 48 additions and 31 deletions

View File

@@ -5,10 +5,13 @@ import img from "@/config/images";
interface IProps {
reload?: () => void;
text?: string;
errorImg?: string;
btnText?: string;
btnImg?: string;
}
const ListLoadError = (props: IProps) => {
const { reload, text } = props;
const { reload, text, errorImg, btnText, btnImg } = props;
const handleReload = () => {
reload && typeof reload === "function" && reload();
};
@@ -17,13 +20,13 @@ const ListLoadError = (props: IProps) => {
<View className={styles.listLoadError}>
<Image
className={styles.listLoadErrorImg}
src={img.ICON_LIST_LOAD_ERROR}
src={errorImg ? img[errorImg] : img.ICON_LIST_LOAD_ERROR}
/>
{text && <Text className={styles.listLoadErrorText}>{text}</Text>}
{reload && (
<Button className={styles.listLoadErrorBtn} onClick={handleReload}>
<Image src={img?.ICON_LIST_RELOAD} className={styles.reloadIcon} />
<Image src={btnImg ? img[btnImg] : img?.ICON_LIST_RELOAD} className={styles.reloadIcon} />
{btnText ? " " + btnText : "重试"}
</Button>
)}
</View>