【发布时间】:2017-03-07 13:36:24
【问题描述】:
我按照下一个例子:
https://github.com/ant-design/ant-design/blob/master/components/form/demo/normal-login.md
组件的代码和样式表分开描述。我必须如何在 react 组件中包含 css?
我尝试创建一个login.css 文件:
#components-form-demo-normal-login .login-form {
max-width: 300px;
}
#components-form-demo-normal-login .login-form-forgot {
float: right;
}
#components-form-demo-normal-login .login-form-button {
width: 100%;
}
然后将className(提交按钮)修改为:
import styles from './login.css';
<Button type="primary" htmlType="submit" className={styles.login-form-button}>
Log in
</Button>
但是 webpack 告诉我:
42:76 error 'form' is not defined no-undef
42:81 error 'button' is not defined no-undef
如何包含样式表?
【问题讨论】: