2019-01-12 03:33:27 +00:00
|
|
|
import PropTypes from '../_util/vue-types';
|
|
|
|
import { hasProp, getComponentFromProp } from '../_util/props-util';
|
2019-03-13 01:38:54 +00:00
|
|
|
import { ConfigConsumerProps } from '../config-provider';
|
2018-01-15 02:52:16 +00:00
|
|
|
|
2018-03-19 02:47:23 +00:00
|
|
|
export default {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'ABreadcrumbItem',
|
2018-03-19 02:47:23 +00:00
|
|
|
__ANT_BREADCRUMB_ITEM: true,
|
|
|
|
props: {
|
2019-03-13 01:38:54 +00:00
|
|
|
prefixCls: PropTypes.string,
|
2018-03-19 02:47:23 +00:00
|
|
|
href: PropTypes.string,
|
|
|
|
separator: PropTypes.any,
|
|
|
|
},
|
2019-03-13 01:38:54 +00:00
|
|
|
inject: {
|
2019-09-11 14:35:25 +00:00
|
|
|
configProvider: { default: () => ConfigConsumerProps },
|
2019-03-13 01:38:54 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
2019-03-13 01:38:54 +00:00
|
|
|
const { prefixCls: customizePrefixCls, $slots } = this;
|
2019-09-11 14:35:25 +00:00
|
|
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
2019-03-13 01:38:54 +00:00
|
|
|
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
|
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
const children = $slots.default;
|
|
|
|
let link;
|
2018-03-19 02:47:23 +00:00
|
|
|
if (hasProp(this, 'href')) {
|
2019-01-12 03:33:27 +00:00
|
|
|
link = <a class={`${prefixCls}-link`}>{children}</a>;
|
2018-03-19 02:47:23 +00:00
|
|
|
} else {
|
2019-01-12 03:33:27 +00:00
|
|
|
link = <span class={`${prefixCls}-link`}>{children}</span>;
|
2018-03-19 02:47:23 +00:00
|
|
|
}
|
|
|
|
if (children) {
|
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
{link}
|
2019-01-12 03:33:27 +00:00
|
|
|
<span class={`${prefixCls}-separator`}>
|
|
|
|
{getComponentFromProp(this, 'separator') || '/'}
|
|
|
|
</span>
|
2018-03-19 02:47:23 +00:00
|
|
|
</span>
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2018-03-19 02:47:23 +00:00
|
|
|
}
|
2019-01-12 03:33:27 +00:00
|
|
|
return null;
|
2018-03-19 02:47:23 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|