Jon*_*Jon 1 javascript reactjs antd ant-design-pro
我是 ReactJS 的初学者,目前我正在使用styled-component一些模块的样式。实际上我在一个文件夹中创建了 2 个文件。一个是style.js我正在制作 2,3 对象,现在我想将这 3 个对象导出到我的另一个文件,该文件的名称是2nd.js但它对我不起作用你能帮我吗我如何将style.js对象导入到我的文件中。
Style.js 代码
import styled from 'styled-components';
export const SubText = styled.div`
font-size: 20px;
text-align: center;
padding-bottom: 30px;
width: 330px;
color: #012653;
margin: 0 auto;
font-weight: 440;
`;
export const GeneralText = styled.div`
color: red;
font-size: 26px;
font-weight: 600;
text-align: center;
min-width: 266px;
padding-bottom: 30px;
font-family: Lato, sans-serif;
margin-top: 50px;
color: #012653;
`;
export const ButtonWrapper = styled.div`
text-align: center;
margin-top: 26px;
`;
Run Code Online (Sandbox Code Playgroud)
第二个.js代码
import Style from './Style';
<GeneralText>This is dummy text </GeneralText>
Run Code Online (Sandbox Code Playgroud)
您可以通过以下方式执行此操作:-
import {SubText, GeneralText, ButtonWrapper} from './style'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1156 次 |
| 最近记录: |