New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Breadcrumb.Separator #17873
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react'; | ||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; | ||
|
||
export default class BreadcrumbSeparator extends React.Component<any> { | ||
static __ANT_BREADCRUMB_SEPARATOR = true; | ||
|
||
renderSeparator = ({ getPrefixCls }: ConfigConsumerProps) => { | ||
const { children } = this.props; | ||
const prefixCls = getPrefixCls('breadcrumb'); | ||
|
||
return <span className={`${prefixCls}-separator`}>{children || '/'}</span>; | ||
}; | ||
|
||
render() { | ||
return <ConfigConsumer>{this.renderSeparator}</ConfigConsumer>; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
order: 6 | ||
title: | ||
zh-CN: 分隔符 | ||
en-US: Configuring the Separator | ||
--- | ||
|
||
## zh-CN | ||
|
||
使用 `Breadcrumb.Separator` 可以自定义分隔符。 | ||
|
||
## en-US | ||
|
||
The separator can be customized by setting the separator property: `Breadcrumb.Separator` | ||
|
||
```jsx | ||
import { Breadcrumb } from 'antd'; | ||
|
||
ReactDOM.render( | ||
<Breadcrumb separator=""> | ||
<Breadcrumb.Item>Location</Breadcrumb.Item> | ||
<Breadcrumb.Separator>:</Breadcrumb.Separator> | ||
<Breadcrumb.Item href="">Application Center</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item href="">Application List</Breadcrumb.Item> | ||
<Breadcrumb.Separator /> | ||
<Breadcrumb.Item>An Application</Breadcrumb.Item> | ||
</Breadcrumb>, | ||
mountNode, | ||
); | ||
``` | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import Breadcrumb from './Breadcrumb'; | ||
import BreadcrumbItem from './BreadcrumbItem'; | ||
import BreadcrumbSeparator from './BreadcrumbSeparator'; | ||
|
||
export { BreadcrumbProps } from './Breadcrumb'; | ||
export { BreadcrumbItemProps } from './BreadcrumbItem'; | ||
|
||
Breadcrumb.Item = BreadcrumbItem; | ||
Breadcrumb.Separator = BreadcrumbSeparator; | ||
export default Breadcrumb; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,11 @@ title: Breadcrumb | |
|
||
### Breadcrumb.Item | ||
|
||
| 参数 | 参数 | 类型 | 默认值 | 版本 | | ||
| --------- | -------------- | -------------------------------------- | ------ | ------ | | ||
| href | 链接的目的地 | string | - | 3.17.0 | | ||
| separator | 自定义的分隔符 | string\|ReactNode | '/' | 3.17.0 | | ||
| overlay | 下拉菜单的内容 | [Menu](/components/menu) \| () => Menu | - | 3.17.0 | | ||
| onClick | 单击事件 | (e:MouseEvent)=>void | - | 3.17.0 | | ||
| 参数 | 参数 | 类型 | 默认值 | 版本 | | ||
| ------- | -------------- | -------------------------------------- | ------ | ------ | | ||
| href | 链接的目的地 | string | - | 3.17.0 | | ||
| overlay | 下拉菜单的内容 | [Menu](/components/menu) \| () => Menu | - | 3.17.0 | | ||
| onClick | 单击事件 | (e:MouseEvent)=>void | - | 3.17.0 | | ||
|
||
### routes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 文档里要加一下 Breadcrumb.Separator 的说明。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 说明的表格中的“版本”字段该如何填写? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3.21.0 好了,赶上车这个月底就发了。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separator-1.md
=>separator-indepent.md