我正在嘗試在對話框上顯示小吃欄。我的對話框的 zIndex 為 1500,它一定是這個。我的小吃欄是一個使用 MaterialUI Snackbar 的自定義組件,它的 zIndex 自動為 1400,我想更改它,但我的方法不起作用。const useContentStyles = makeStyles((theme: Theme) => ({ containerRoot :{ color:'blue !important', backgroundColor: 'green !important', zIndex: 1501, }}))const App: FunctionComponent = () => {return ( <> <SnackbarProvider maxSnack={4} anchorOrigin={{vertical: 'bottom', horizontal: 'center'}} classes={{containerRoot: classes.containerRoot}}> <SnackbarConsumer messageType={'error'} time={4000} /> <SnackbarConsumer messageType={'success'} time={4000} /> <SnackbarConsumer messageType={'info'} time={4000} /> <SnackbarConsumer messageType={'warning'} time={4000} /> </SnackbarProvider>; </> )}我的 zIndex 已應用,但我必須寫 !important 才能使其工作,但我不能這樣做:const useContentStyles = makeStyles((theme: Theme) => ({ containerRoot :{ color:'blue !important', backgroundColor: 'green !important', zIndex: 1501 !important, }}))我能做些什么 ?
!makeStyle 很重要
眼眸繁星
2023-07-06 10:06:17