step.jsx 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. import { ElStep, ElIcon } from 'element-plus'
  2. import { WarningFilled } from '@element-plus/icons-vue'
  3. import { generateProps } from '../helper/component-util'
  4. import { componentScheme } from './step.scheme'
  5. import './index.less'
  6. export default {
  7. name: 'cip-step',
  8. props: generateProps(componentScheme),
  9. setup (props, { emit, slots }) {
  10. return () => <>
  11. {
  12. props.status === 'error' // error状态的图标根据ui规范特殊处理,带有状态属性时,传入icon会显示异常
  13. ? <ElStep {...props} status="process">
  14. {{
  15. icon: () => <ElIcon class="is-error-icon"><WarningFilled/></ElIcon>,
  16. title: slots.title?.(),
  17. description: slots.description?.()
  18. }}
  19. </ElStep>
  20. : <ElStep {...props}>
  21. {{
  22. icon: slots.icon?.(),
  23. title: slots.title?.(),
  24. description: slots.description?.()
  25. }}
  26. </ElStep>
  27. }
  28. </>
  29. }
  30. }