赞
踩
:global{
.ant-card{
background: #61dafb;
.ant-card-body{
background: red;
opacity: 0.1;
}
}
}
:global(.ant-collapse-content-box) {
height: 150px;
.content {
color: red;
}
}
例子
import React from 'react' import styles from './style.less' import {Card, Collapse} from "antd"; const Example: React.FC<any> = () => { //FC尖括号里面如果父组件传下来有props如name 可写const Example: React.FC<{name:string}> = () => { const {Panel} = Collapse; return ( <div className={styles.page}> <Collapse defaultActiveKey={['1']}> <Panel header="嵌套模块化的class" key="1"> <div className={styles.content}> 此 content属性为嵌套后的 </div> </Panel> </Collapse> <Card title="不嵌套模块化的class" extra={<a href="#">More</a>} style={{ width: 300 }}> <p>Card content</p> <p>Card content</p> <p>Card content</p> </Card> </div>) } export default Example;
// style.less :global(.ant-collapse-content-box) { height: 150px; .content { color: red; } } :global{ .ant-card{ background: #61dafb; .ant-card-body{ background: red; opacity: 0.1; } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。