2018-03-19 10:16:27 +08:00
|
|
|
|
2018-01-30 18:22:41 +08:00
|
|
|
import PropTypes from '../_util/vue-types'
|
2018-09-19 13:21:57 +08:00
|
|
|
const Divider = {
|
2018-04-08 21:17:20 +08:00
|
|
|
name: 'ADivider',
|
2018-01-30 18:22:41 +08:00
|
|
|
props: {
|
|
|
|
prefixCls: PropTypes.string.def('ant'),
|
2018-09-05 21:28:54 +08:00
|
|
|
type: PropTypes.oneOf(['horizontal', 'vertical', '']).def('horizontal'),
|
2018-01-30 18:22:41 +08:00
|
|
|
dashed: PropTypes.bool,
|
2018-04-07 14:29:59 +08:00
|
|
|
orientation: PropTypes.oneOf(['left', 'right']),
|
2018-01-30 18:22:41 +08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
classString () {
|
2018-04-07 14:29:59 +08:00
|
|
|
const { prefixCls, type, $slots, dashed, orientation = '' } = this
|
|
|
|
const orientationPrefix = (orientation.length > 0) ? '-' + orientation : orientation
|
|
|
|
|
2018-01-30 18:22:41 +08:00
|
|
|
return {
|
|
|
|
[`${prefixCls}-divider`]: true, [`${prefixCls}-divider-${type}`]: true,
|
2018-04-07 14:29:59 +08:00
|
|
|
[`${prefixCls}-divider-with-text${orientationPrefix}`]: $slots.default,
|
2018-01-30 18:22:41 +08:00
|
|
|
[`${prefixCls}-divider-dashed`]: !!dashed,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
render () {
|
|
|
|
const { classString, prefixCls, $slots } = this
|
|
|
|
return (
|
|
|
|
<div class={classString}>
|
2018-04-07 14:29:59 +08:00
|
|
|
{$slots.default && <span class={`${prefixCls}-divider-inner-text`}>{$slots.default}</span>}
|
2018-01-30 18:22:41 +08:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
2018-03-19 10:16:27 +08:00
|
|
|
|
2018-09-19 13:21:57 +08:00
|
|
|
/* istanbul ignore next */
|
|
|
|
Divider.install = function (Vue) {
|
|
|
|
Vue.component(Divider.name, Divider)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Divider
|
|
|
|
|