优化空状态图片样式
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user