Ant-design: 在某些组件中没有继承`prefixCls`

创建于 2018-06-09  ·  4评论  ·  资料来源: ant-design/ant-design

这是一个跟踪问题,以跟踪prefixCls

  • []#10017标记:prefixCls没有传递给Icon
  • []#10565模态:prefixCls未传递给Button
  • [x]#12546 Modal.xxx:未将prefixCls传递给掩码
  • []#10042上传-拖动程序:将prefixCls传递到UploadList-上传
  • []转移
  • []#12676 Popconfirm:prefixCls未传递给Button
Inactive IssueHuntFest help wanted

最有用的评论

从内部讨论:

我们将为prefixCls的配置引入一个名为ConfigProvider的新提供程序。

import { ConfigProvider, Button } from 'antd';

<ConfigProvider prefixCls="awesome-">
  <Button>A Button</Button>
</ConfigProvider

产生:

<button type="button" class="awesome-btn"><span>A Button</span></button>

所有4条评论

我相信Input应该列入清单。

使用import 'antd/dist/antd.less'import 'antd/lib/input/style'

.ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    line-height: 0;
    color: rgba(0, 0, 0, 0.65);
}

在使用import 'antd/dist/antd.css'将具有浏览器特定的前缀

.ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
    position: absolute;
    top: 50%;
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
    line-height: 0;
    color: rgba(0, 0, 0, 0.65);
}

@chungwong不一样的问题。

从内部讨论:

我们将为prefixCls的配置引入一个名为ConfigProvider的新提供程序。

import { ConfigProvider, Button } from 'antd';

<ConfigProvider prefixCls="awesome-">
  <Button>A Button</Button>
</ConfigProvider

产生:

<button type="button" class="awesome-btn"><span>A Button</span></button>

通过#12991解决

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

AhmedSayed77 picture AhmedSayed77  ·  3评论

xtznhzxdev picture xtznhzxdev  ·  3评论

ryannealmes picture ryannealmes  ·  3评论

PeteAndersen picture PeteAndersen  ·  3评论

tianyacsdn picture tianyacsdn  ·  3评论