view.jsx 695 B

1234567891011121314151617181920
  1. import { layoutProps } from '../layout-props'
  2. import { ElTimeline, ElTimelineItem } from 'element-plus'
  3. import './index.less'
  4. export default {
  5. props: layoutProps,
  6. setup (props, { slots }) {
  7. const Item = (option, index) => {
  8. const { children: step, ...stepConfig } = option
  9. const title = !props.config.hideIndex ? `第${index + 1}步:${stepConfig.title}` : stepConfig.title
  10. return <ElTimelineItem class={'cip-steps-view__item'} timestamp={title} placement="top">
  11. {slots.item?.({ col: step })}
  12. </ElTimelineItem>
  13. }
  14. return () => (
  15. <ElTimeline class={'cip-steps-view'}>
  16. {props.config.options?.map(Item)}
  17. </ElTimeline>
  18. )
  19. }
  20. }