简体   繁体   中英

can't disable Step(dynamically) with Ant Design

Step button is not being disabled. I want to disable it.

return Object.keys(props.quiz).length> 0 ? 
        <div>
            <Steps size="small" current={0} onChange={props.onChange}>
                    {
                        props.quiz.questions.map(item => 
                           <Step key={item.id} disabled/>
                    }
            </Steps>
       </div>

Result below:

在此处输入图片说明

the disabled attribute works fine on each Step

Here is an updated example with a dynamic disabled field in the array: https://codesandbox.io/s/naughty-hooks-70mpd?fontsize=14

Note you don't need to write disabled={true} as disabled is the shorthand. I presume the ** was your emphasis and not part of the code.

I've taken the Damian code and made it dynamic without any problems. You can check here: https://codesandbox.io/s/mutable-microservice-51dhh

Make sure that you're using the latest antd version and if you still have any difficulties try to reproduce the error in isolation (create a project in codesandbox to show the error).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM