import { inject } from 'vue'; import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; import { getOptionProps, initDefaultProps, getComponent } from '../_util/props-util'; import { defaultConfigProvider } from '../config-provider'; export const TimeLineItemProps = { prefixCls: PropTypes.string, color: PropTypes.string, dot: PropTypes.any, pending: PropTypes.looseBool, position: PropTypes.oneOf(['left', 'right', '']).def(''), }; export default { name: 'ATimelineItem', props: initDefaultProps(TimeLineItemProps, { color: 'blue', pending: false, }), setup() { const configProvider = inject('configProvider', defaultConfigProvider); return { configProvider, }; }, render() { const { prefixCls: customizePrefixCls, color = '', pending } = getOptionProps(this); const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('timeline', customizePrefixCls); const dot = getComponent(this, 'dot'); const itemClassName = classNames({ [`${prefixCls}-item`]: true, [`${prefixCls}-item-pending`]: pending, }); const dotClassName = classNames({ [`${prefixCls}-item-head`]: true, [`${prefixCls}-item-head-custom`]: dot, [`${prefixCls}-item-head-${color}`]: true, }); return (
  • {dot}
    {this.$slots.default && this.$slots.default()}
  • ); }, };