ant-design-vue/components/divider/index.jsx

32 lines
959 B
React
Raw Normal View History

2018-03-19 02:16:27 +00:00
2018-01-30 10:22:41 +00:00
import PropTypes from '../_util/vue-types'
export default {
props: {
prefixCls: PropTypes.string.def('ant'),
type: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'),
dashed: PropTypes.bool,
2018-04-07 06:29:59 +00:00
orientation: PropTypes.oneOf(['left', 'right']),
2018-01-30 10:22:41 +00:00
},
computed: {
classString () {
2018-04-07 06:29:59 +00:00
const { prefixCls, type, $slots, dashed, orientation = '' } = this
const orientationPrefix = (orientation.length > 0) ? '-' + orientation : orientation
2018-01-30 10:22:41 +00:00
return {
[`${prefixCls}-divider`]: true, [`${prefixCls}-divider-${type}`]: true,
2018-04-07 06:29:59 +00:00
[`${prefixCls}-divider-with-text${orientationPrefix}`]: $slots.default,
2018-01-30 10:22:41 +00:00
[`${prefixCls}-divider-dashed`]: !!dashed,
}
},
},
render () {
const { classString, prefixCls, $slots } = this
return (
<div class={classString}>
2018-04-07 06:29:59 +00:00
{$slots.default && <span class={`${prefixCls}-divider-inner-text`}>{$slots.default}</span>}
2018-01-30 10:22:41 +00:00
</div>
)
},
}
2018-03-19 02:16:27 +00:00