How to change Step number with Loading Icon in ReactJS

做~自己de王妃 提交于 2020-01-05 04:00:11

问题


I am working on project in reactjs, Currently I am using Ant-design for Wizard form. I will share ant-design link. I want to change step number with loading icon when user click on next.. The current step number ( for example 1 ) is changed to loading and proceed to next step . I am beginner could you please help me ?

Ant-Design Link: Ant-design


回答1:


This can be done by using steps custom icon property. The idea is you can pass the key in steps as given below:

const steps = [
  {
    title: "First",
    content: "First-content",
    key: 1
  },
  {
    title: "Second",
    content: "Second-content",
    key: 2
  },
  {
    title: "Last",
    content: "Last-content",
    key: 3
  }
];

And then you can use Icon of type loading in condition to check if current+1 === key as given below:

<Step
    key={item.title}
    title={item.title}
    icon={item.key !== 1 && item.key === current+1 ? <Icon type="loading" /> : ""}
/>

You can check the working demo.



来源:https://stackoverflow.com/questions/53645205/how-to-change-step-number-with-loading-icon-in-reactjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!