是否有一种方法可以修改通过使用来自<span>框架的Checkbox组件生成的material-ui标记?
基本上,我在寻找一种改变的方法:
<span class="MuiButtonBase-root-29 MuiIconButton-root-226 MuiSwitchBase-root-277 MuiCheckbox-root-271 Checkbox-root-265 MuiCheckbox-colorSecondary-276">
<span class="MuiIconButton-label-231">
<svg class="MuiSvgIcon-root-168" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path>
</svg>
<input class="MuiSwitchBase-input-280" name="Chk" type="checkbox" data-indeterminate="false" value="">
</span>
<span class="MuiTouchRipple-root-64"></span>
</span>(更改在第一个<span>标记中)
<span class="MuiButtonBase-root-29 MuiIconButton-root-226 MuiSwitchBase-root-277 MuiCheckbox-root-271 Checkbox-root-265 MuiCheckbox-colorSecondary-276" tabindex=0>
<span class="MuiIconButton-label-231">
<svg class="MuiSvgIcon-root-168" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path>
</svg>
<input class="MuiSwitchBase-input-280" name="Chk" type="checkbox" data-indeterminate="false" value="">
</span>
<span class="MuiTouchRipple-root-64"></span>
</span>谢谢你的帮忙!
发布于 2018-10-24 00:01:06
Checkbox声明"Any other properties supplied will be spread to the root element (native element)",所以您只需给组件一个带有值0的支柱tabindex
import Checkbox from '@material-ui/core/Checkbox';
function MyCheckbox() {
return <Checkbox tabindex={0} />;
}https://stackoverflow.com/questions/52959276
复制相似问题