react中的styled-components简单的用法

    xiaoxiao2025-04-22  17

    npm install --save styled-components

    使用:

    import styled from 'styled-components';

    当使用背景图片时使用import引入 定义全局样式:

    import {createGlobalStyle} from 'styled-components';

    引入全局样式,并将标签写在所有标签样式的最上面就可以保证所有样式都可以使用到全局的样式 iconfont图标的全局使用,将iconfont.css修改为iconfont.js iconfont图标的使用:

    最新回复(0)