import { createNamespace } from '../utils'; import { BORDER } from '../utils/constant'; import { ChildrenMixin } from '../mixins/relation'; import Icon from '../icon'; const [createComponent, bem] = createNamespace('step'); export default createComponent({ mixins: [ChildrenMixin('vanSteps')], computed: { status() { if (this.index < this.parent.active) { return 'finish'; } if (this.index === +this.parent.active) { return 'process'; } }, active() { return this.status === 'process'; }, }, methods: { genCircle() { const { activeIcon, activeColor, inactiveIcon } = this.parent; if (this.active) { return ( this.slots('active-icon') || ( ) ); } const inactiveIconSlot = this.slots('inactive-icon'); if (inactiveIcon || inactiveIconSlot) { return ( inactiveIconSlot || ); } return ; }, }, render() { const { status, active } = this; const { activeColor, direction } = this.parent; const titleStyle = active && { color: activeColor }; const lineStyle = status === 'finish' && { background: activeColor }; return (
{this.slots()}
{this.genCircle()}
); }, });