AntDesign Table Warning: validateDOMNesting(...): Text nodes cannot appear as a child of <tfoot>.
阿新 • • 發佈:2021-01-09
技術標籤:配置JSDOMHTML tagsReactAnt Design
使用 AntDesign Table 的時候發生了報錯,如下:
Warning: validateDOMNesting(...): Text nodes cannot appear as a child of <tfoot>.
Warning: validateDOMNesting(...): <span> nodes cannot appear as a child of <tfoot>.
錯誤原因:
我寫的渲染方法導致最終的DOM巢狀有問題。
錯誤點: Table元件的summary
我的錯誤寫法:
summary={(currentData) => {
return "總結內容";
// return (<span>總結內容</span>);
}}
正確寫法如下:
見: https://ant.design/components/table-cn/#header
如果你不是因為 AntDesign Table 元件的 summary 屬性而報錯。
只能根據自己的具體情況分析解決。