You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/divider/index.jsx

44 lines
1.3 KiB

import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import Base from '../base';
const Divider = {
name: 'ADivider',
props: {
prefixCls: PropTypes.string,
type: PropTypes.oneOf(['horizontal', 'vertical', '']).def('horizontal'),
dashed: PropTypes.bool,
orientation: PropTypes.oneOf(['left', 'right']),
},
inject: {
configProvider: { default: () => ({}) },
},
render() {
const { prefixCls: customizePrefixCls, type, $slots, dashed, orientation = '' } = this;
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
const prefixCls = getPrefixCls('divider', customizePrefixCls);
const orientationPrefix = orientation.length > 0 ? '-' + orientation : orientation;
const classString = {
[prefixCls]: true,
[`${prefixCls}-${type}`]: true,
[`${prefixCls}-with-text${orientationPrefix}`]: $slots.default,
[`${prefixCls}-dashed`]: !!dashed,
};
return (
<div class={classString}>
{$slots.default && <span class={`${prefixCls}-inner-text`}>{$slots.default}</span>}
</div>
);
},
};
/* istanbul ignore next */
Divider.install = function(Vue) {
Vue.use(Base);
Vue.component(Divider.name, Divider);
};
export default Divider;