接下来记录一下项目引用emotion,还是得多练才能说我会用react喔
1.首先是安装emotion依赖包
npm i @emotion/react
npm i @emotion/styled
2.接着是组件引入emotion
// 引入emotion
import styled from "@emotion/styled”;
3.emotion渲染html标签写法
//在html代码中使用css组件:
<Container>
//html代码
</Container>
// 使用emotion 创建css组件
const Container = styled.div`
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
`;
`4.emotion渲染自定义组件
// Card 是antd已存在的组件
const ShadowCard = styled(Card)`
width: 40rem;
min-height: 56rem;
padding: 3.2rem 4rem;
border-radius: 0.3rem;
box-sizing: border-box;
box-shadow: rgba(0, 0, 0, 0.1) 0 0 10px;
text-align: center;
`;
暂时这些够用了,不够用请参考文档