Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何使用变量而不是“禁用字段集”;禁用";单词_Reactjs_Fieldset_Isenabled - Fatal编程技术网

Reactjs 如何使用变量而不是“禁用字段集”;禁用";单词

Reactjs 如何使用变量而不是“禁用字段集”;禁用";单词,reactjs,fieldset,isenabled,Reactjs,Fieldset,Isenabled,我学习了React JavaScript,现在我遇到了这个问题 阅读 我想在这段代码中使用currentEditableFile,如果设置fieldset=enabled是真的,但它不能使用三元,如您在这里看到的: <fieldset className={classes.tagssList} {currentEditableFile ? enabled: disabled}> <legend>Select Tags to include</lege

我学习了React JavaScript,现在我遇到了这个问题

阅读

我想在这段代码中使用
currentEditableFile
,如果设置fieldset=enabled是真的,但它不能使用三元,如您在这里看到的:

<fieldset className={classes.tagssList} {currentEditableFile ? enabled: disabled}>
        <legend>Select Tags to include</legend>
        {tagsList.map(skill => (
            <button
                className="btn btn-warning btn-sm"
                disabled={false}
                key={skill}
                type="button"
                onClick={() => (currentEditableFile ? onSaveTag(skill) : null)}
            >
                {skill}
            </button>
        ))}
    </fieldset>

选择要包括的标记
{tagsList.map(技能=>(
(currentEditableFile?onSaveTag(技能):null)}
>
{skill}
))}

请按如下方式使用:

<fieldset disabled={!currentEditableFile} >


请检查

您可以这样做。将禁用的
值设置为
!currentEditableFile
,这意味着如果
currentEditableFile
true
字段集上的
已禁用
将为
false

<fieldset className={classes.tagssList} disabled={!currentEditableFile}>
        <legend>Select Tags to include</legend>
        {tagsList.map(skill => (
            <button
                className="btn btn-warning btn-sm"
                disabled={false}
                key={skill}
                type="button"
                onClick={() => (currentEditableFile ? onSaveTag(skill) : null)}
            >
                {skill}
            </button>
        ))}
    </fieldset>

选择要包括的标记
{tagsList.map(技能=>(
(currentEditableFile?onSaveTag(技能):null)}
>
{skill}
))}