![](/img/trans.png)
[英]Cannot add row in antd with React Class Component using TypeScript
[英]I have a React component using Antd, need to style the background of every other row
我有一個使用Antd的組件,並且嘗試使用nth-child()
選擇器來設置其他每行的背景顏色,但是我不知道如何使用Antd。
我通讀了他們的文檔,並嘗試通過擴展我的Collapse組件的樣式來添加${Row}:nth-child(2){ background-color: white;}
來應用該邏輯,但是出現了一個類型錯誤,即typeOf行不可分配給'CSSObject'類型
我下面有一個代碼沙箱,其中包含初始樣式和布局。
您可以使用ant設計類名稱來編輯Body組件,如下所示:
const Body = styled.div`
background-color: #f7f7f7;
.ant-row:nth-child(even) {
background-color: yellow;
}
`;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.