Javascript 禁用所有材质ui组件上的拼写检查

Javascript 禁用所有材质ui组件上的拼写检查,javascript,reactjs,material-ui,Javascript,Reactjs,Material Ui,是否有办法全局禁用材质ui组件的拼写检查 在使用材质ui库之前,我使用了以下代码片段来禁用所有新创建的DOM元素的拼写检查: const disableSpellCheck = function(mutations) { const mutationCount = mutations.length; for (let i = 0; i < mutationCount; i++) { const mutation = mutations[i];

是否有办法全局禁用
材质ui
组件的拼写检查

在使用
材质ui
库之前,我使用了以下代码片段来禁用所有新创建的DOM元素的拼写检查:

const disableSpellCheck = function(mutations) 
{
    const mutationCount = mutations.length;

    for (let i = 0; i < mutationCount; i++) {
        const mutation = mutations[i];
        if (mutation.attributeName === "spellcheck") {
            const addedNodes = mutation.addedNodes;
            const nodeCount = addedNodes.length;

            for (let n = 0; n < nodeCount; n++) {
                addedNodes[n].setAttribute("spellcheck", "false");
            }
        }
    }
}

const observer = new MutationObserver(disableSpellCheck);

observer.observe(document.getElementById('root'), {
    childList: true, 
    subtree: true,
    attributes: true, 
    attributeFilter: ['spellcheck']
});
const disableSpellCheck=函数(突变)
{
const mutationCount=mutations.length;
for(设i=0;i

这似乎不适用于
材质ui
中的组件。因为在整个应用程序中禁用拼写检查是非常重要的,所以我正在寻找一种解决方案,它不涉及单独修改每个组件的样式。

为了做到这一点,应该为输入提供
拼写检查
道具

这可以通过以下方式在物料界面中完成:

<Input inputProps={{ spellCheck: 'false' }}/>

默认道具可应用于具有主题的所有输入:

const theme = createMuiTheme({
  props: {
    MuiInput: { inputProps: { spellCheck: 'false' } }
  }
});

...

<MuiThemeProvider theme={theme}>...</MuiThemeProvider>
const theme=createMuiTheme({
道具:{
MuiInput:{inputProps:{拼写检查:'false'}
}
});
...
...

试试这个:这并不能解决我的问题