我正在嘗試在警報組件中使用全寬(寬度:100%)骨架。但是骷髏并沒有占據所有的位置。

相關代碼:
<Alert
icon={<NotificationsIcon sx={{ color: "#000000B3" }} />}
sx={{
color: "#000000B3",
background: "#ebebeb",
width: "100%",
height: "100%",
}}
action={
<IconButton>
<OpenInNewIcon sx={{ color: "#000000B3" }} />
</IconButton>
}
>
<AlertTitle>
<Skeleton variant="text" width="100%" />
</AlertTitle>
<Skeleton variant="text" width="100%" />
</Alert>
謝謝!
編輯(評論請求):
我已經匯入了組件:
import {
Alert,
AlertTitle,
Skeleton,
} from "@mui/material";
和父組件:
<ListItem disableGutters dense key={index}>
<Alert>...</Alert>
</ListItem>
uj5u.com熱心網友回復:
Alert組件內的包裝器似乎不是全寬。
您應該MuiAlert-message像這樣更新類名的樣式。
<Alert
icon={<NotificationsIcon sx={{ color: "#000000B3" }} />}
sx={{
color: "#000000B3",
background: "#ebebeb",
width: "100%",
height: "100%",
'& .MuiAlert-message': {
width: '100%'
}
}}
action={
<IconButton>
<OpenInNewIcon sx={{ color: "#000000B3" }} />
</IconButton>
}
>
<AlertTitle>
<Skeleton variant="text" width="100%" />
</AlertTitle>
<Skeleton variant="text" width="100%" />
</Alert>

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/386925.html
下一篇:無法在div中向右移動文本
