2018-01-15 02:52:16 +00:00
|
|
|
<script>
|
|
|
|
import PropTypes from '../_util/vue-types'
|
2018-03-10 05:34:26 +00:00
|
|
|
import { hasProp, getComponentFromProp } from '../_util/props-util'
|
2018-01-15 02:52:16 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BreadcrumbItem',
|
2018-03-10 05:34:26 +00:00
|
|
|
__ANT_BREADCRUMB_ITEM: true,
|
2018-01-15 02:52:16 +00:00
|
|
|
props: {
|
|
|
|
prefixCls: PropTypes.string.def('ant-breadcrumb'),
|
|
|
|
href: PropTypes.string,
|
2018-03-10 05:34:26 +00:00
|
|
|
separator: PropTypes.any,
|
2018-01-15 02:52:16 +00:00
|
|
|
},
|
|
|
|
render () {
|
2018-03-10 05:34:26 +00:00
|
|
|
const { prefixCls, $slots } = this
|
|
|
|
const children = $slots.default
|
2018-01-15 02:52:16 +00:00
|
|
|
let link
|
2018-01-16 03:13:22 +00:00
|
|
|
if (hasProp(this, 'href')) {
|
2018-03-10 05:34:26 +00:00
|
|
|
link = <a class={`${prefixCls}-link`}>{children}</a>
|
2018-01-15 02:52:16 +00:00
|
|
|
} else {
|
2018-03-10 05:34:26 +00:00
|
|
|
link = <span class={`${prefixCls}-link`}>{children}</span>
|
2018-01-15 02:52:16 +00:00
|
|
|
}
|
2018-03-10 05:34:26 +00:00
|
|
|
if (children) {
|
2018-01-15 02:52:16 +00:00
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
{link}
|
2018-03-10 05:34:26 +00:00
|
|
|
<span class={`${prefixCls}-separator`}>{getComponentFromProp(this, 'separator') || '/'}</span>
|
2018-01-15 02:52:16 +00:00
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|