2018-01-15 10:52:16 +08:00
|
|
|
<script>
|
|
|
|
import PropTypes from '../_util/vue-types'
|
2018-01-16 11:13:22 +08:00
|
|
|
import hasProp from '../_util/props-util'
|
2018-01-15 10:52:16 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BreadcrumbItem',
|
|
|
|
inject: ['breadCrumbParent'],
|
|
|
|
props: {
|
|
|
|
prefixCls: PropTypes.string.def('ant-breadcrumb'),
|
|
|
|
href: PropTypes.string,
|
|
|
|
},
|
|
|
|
render () {
|
2018-01-16 11:13:22 +08:00
|
|
|
const { prefixCls, ...restProps } = this.$props
|
2018-01-15 10:52:16 +08:00
|
|
|
const { breadCrumbParent = {}} = this
|
|
|
|
const { separator = '/' } = breadCrumbParent
|
|
|
|
const solt = this.$slots.default
|
|
|
|
let link
|
2018-01-16 11:13:22 +08:00
|
|
|
if (hasProp(this, 'href')) {
|
2018-01-15 10:52:16 +08:00
|
|
|
link = <a class={`${prefixCls}-link`} {...restProps}>{solt}</a>
|
|
|
|
} else {
|
|
|
|
link = <span class={`${prefixCls}-link`} {...restProps}>{solt}</span>
|
|
|
|
}
|
|
|
|
if (solt) {
|
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
{link}
|
|
|
|
<span class={`${prefixCls}-separator`}>{separator}</span>
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|