在react渲染时,有没有方法将id添加到材质ui类?
例如
来自
.MuiInputLabel-outlined {
z-index: 1;
transform: translate(14px, 20px) scale(1);
pointer-events: none;
}
至
#root-id-here .MuiInputLabel-outlined {
z-index: 1;
transform: translate(14px, 20px) scale(1);
pointer-events: none;
}
是的,有两种方法可以解决这个
-
Javascript:-
const test = document.getElementByClassName(‘.MuiInputLabel-outlined’); test.setAttribute(‘id’,‘IdName’);
- Jquery:-
.$('MuiInputLabel-outlined').addID('some-class');