這是我的第一個問題,所以我希望能夠正確解釋。我已經導入了一個 datepicker 元素,并且嘗試通過執行以下操作來覆蓋類屬性:const useStyles = makeStyles({ testingWidthLimit: { width: '180px !important', minWidth: '180px !important', maxWidth: '180px !important', },};const { testingWidthLimit } = useStyles();<InputDate className={testingWidthLimit} {other properties here}/>由于我的初學者聲譽,我無法發布圖片,但這就是屏幕上呈現的內容:<div class="sc-gXZlrW ikzFYF makeStyles-testingWidthLimit-3"> <div class="react-date-picker react-date-picker--closed react-date-picker--enabled"> <div class="react-date-picker__wrapper"> (the rest goes here but that is not important) </div> </div></div>哦,班級"react-date-picker__wrapper"財產"min-width: 264px"仍然存在正如您所看到的,我已經嘗試了我所知道的所有屬性,但仍然不會覆蓋子屬性。我無權訪問 InputDate 代碼,但我必須使用它。我嘗試使用 !important (有或沒有空格,就像我在其他問題上看到的那樣)和一次一個屬性,但仍然不起作用,有人能告訴我我錯過了什么嗎?Edit1:在第一個 div 上,我的類正在被應用,所有屬性都帶有 !important 標簽。
使用material-ui覆蓋子類屬性
慕森卡
2023-08-18 17:24:04