2019-01-12 03:33:27 +00:00
|
|
|
import PropTypes from '../_util/vue-types';
|
2018-09-19 05:21:57 +00:00
|
|
|
const Divider = {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'ADivider',
|
2018-01-30 10:22:41 +00:00
|
|
|
props: {
|
|
|
|
prefixCls: PropTypes.string.def('ant'),
|
2018-09-05 13:28:54 +00:00
|
|
|
type: PropTypes.oneOf(['horizontal', 'vertical', '']).def('horizontal'),
|
2018-01-30 10:22:41 +00:00
|
|
|
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: {
|
2019-01-12 03:33:27 +00:00
|
|
|
classString() {
|
|
|
|
const { prefixCls, type, $slots, dashed, orientation = '' } = this;
|
|
|
|
const orientationPrefix = orientation.length > 0 ? '-' + orientation : orientation;
|
2018-04-07 06:29:59 +00:00
|
|
|
|
2018-01-30 10:22:41 +00:00
|
|
|
return {
|
2019-01-12 03:33:27 +00:00
|
|
|
[`${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,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-01-30 10:22:41 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
const { classString, prefixCls, $slots } = this;
|
2018-01-30 10:22:41 +00:00
|
|
|
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>
|
2019-01-12 03:33:27 +00:00
|
|
|
);
|
2018-01-30 10:22:41 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-03-19 02:16:27 +00:00
|
|
|
|
2018-09-19 05:21:57 +00:00
|
|
|
/* istanbul ignore next */
|
2019-01-12 03:33:27 +00:00
|
|
|
Divider.install = function(Vue) {
|
|
|
|
Vue.component(Divider.name, Divider);
|
|
|
|
};
|
2018-09-19 05:21:57 +00:00
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
export default Divider;
|