亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

!makeStyle 很重要

!makeStyle 很重要

眼眸繁星 2023-07-06 10:06:17
我正在嘗試在對話框上顯示小吃欄。我的對話框的 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,    }}))我能做些什么 ?
查看完整描述

1 回答

?
Cats萌萌

TA貢獻1805條經驗 獲得超9個贊

也許模板文字可能是一個解決方案。


const index = 1501;

containerRoot :{

    color:'blue !important',

    backgroundColor: 'green !important',

    zIndex: `${index} !important`

}


查看完整回答
反對 回復 2023-07-06
  • 1 回答
  • 0 關注
  • 122 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號