Antd 24栅格系统

  1. import styles from './App.module.css'
  2. import { Header, Footer } from './components'
  3. import { Row, Col } from 'antd'
  4. function App() {
  5. return (
  6. <div className={styles.App}>
  7. <Header />
  8. <div className={styles['page-content']}>
  9. <Row style={{ marginTop: 20 }}>
  10. <Col span={6}>
  11. <div style={{ background: 'red' }}>多重菜单</div>
  12. </Col>
  13. <Col span={18}>
  14. <div style={{ background: 'blue' }}>走马灯</div>
  15. </Col>
  16. </Row>
  17. </div>
  18. <Footer />
  19. </div>
  20. )
  21. }

React可以通过 style 属性设置css, style 是个对象

Carousel 走马灯

  1. import { Image, Carousel as AntCarousel } from 'antd'
  2. import styles from './Carousel.module.css'
  3. import carouselImage1 from '../../assets/images/carousel_1.jpg'
  4. import carouselImage2 from '../../assets/images/carousel_2.jpg'
  5. import carouselImage3 from '../../assets/images/carousel_3.jpg'
  6. export const Carousel: React.FC = () => {
  7. return (
  8. <AntCarousel autoplay className={styles.slider}>
  9. <Image src={carouselImage1} />
  10. <Image src={carouselImage2} />
  11. <Image src={carouselImage3} />
  12. </AntCarousel>
  13. )
  14. }