ant-design-vue/components/breadcrumb/BreadcrumbItem.jsx

34 lines
821 B
React
Raw Normal View History

2018-03-19 10:16:27 +08:00
2018-03-19 10:47:23 +08:00
import PropTypes from '../_util/vue-types'
import { hasProp, getComponentFromProp } from '../_util/props-util'
2018-01-15 10:52:16 +08:00
2018-03-19 10:47:23 +08:00
export default {
2018-04-08 21:17:20 +08:00
name: 'ABreadcrumbItem',
2018-03-19 10:47:23 +08:00
__ANT_BREADCRUMB_ITEM: true,
props: {
prefixCls: PropTypes.string.def('ant-breadcrumb'),
href: PropTypes.string,
separator: PropTypes.any,
},
render () {
const { prefixCls, $slots } = this
const children = $slots.default
let link
if (hasProp(this, 'href')) {
link = <a class={`${prefixCls}-link`}>{children}</a>
} else {
link = <span class={`${prefixCls}-link`}>{children}</span>
}
if (children) {
return (
<span>
{link}
<span class={`${prefixCls}-separator`}>{getComponentFromProp(this, 'separator') || '/'}</span>
</span>
)
}
return null
},
}
2018-03-19 10:16:27 +08:00