具有父Id的React Material UI类



在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;
}

是的,有两种方法可以解决这个

  1. Javascript:-const test = document.getElementByClassName(‘.MuiInputLabel-outlined’); test.setAttribute(‘id’,‘IdName’);
  2. Jquery:-.$('MuiInputLabel-outlined').addID('some-class');

最新更新