解除 Ant Design Menu 组件警告

发布于: 2020年08月19日 21:34:46 | 分类: 前端 | 浏览: 22

报错堆栈:

index.js:1406 Warning: React does not recognize the `triggerSubMenuAction` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `triggersubmenuaction` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

.........................

index.js:1406 Warning: React does not recognize the `subMenuKey` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `submenukey` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in div (created by Context.Consumer)
    in Spin (at Search.jsx:56)
    in ul (created by DOMWrap)
    in DOMWrap (created by SubPopupMenu)
    in SubPopupMenu (created by Connect(SubPopupMenu))
    in Connect(SubPopupMenu) (created by Menu)
    in Provider (created by Menu)
    in Menu (created by Context.Consumer)
    in InternalMenu (created by Context.Consumer)
    in Menu (at Search.jsx:54)
    in div (created by PopupInner)
    in PopupInner (created by Align)
    in Align (created by CSSMotion)
    in CSSMotion (created by ForwardRef)
    in ForwardRef (created by Popup)
    in div (created by Popup)
    in Popup (created by Trigger)
    in Portal (created by Trigger)
    in Trigger (created by ForwardRef(Dropdown))
    in ForwardRef(Dropdown) (created by Dropdown)
    in Dropdown (at Search.jsx:100)
    in SearchComponent (created by Context.Consumer)
    in withRouter(SearchComponent) (at Header.jsx:106)
    in li (at Header.jsx:105)
    in ul (at Header.jsx:92)
    in div (at Header.jsx:91)
    in nav (at Header.jsx:79)
    in Header (created by ConnectFunction)
    in ConnectFunction (at App.js:13)
    in App (at src/index.js:34)
    in Provider (at src/index.js:33)
    in FormProvider (created by Context.Consumer)
    in LocaleProvider (created by Context.Consumer)
    in SizeContextProvider (created by Context.Consumer)
    in LocaleReceiver (created by ConfigProvider)
    in ConfigProvider (at src/index.js:32)
    in Router (created by BrowserRouter)
    in BrowserRouter (at src/index.js:31)
return <Menu className='textCenter'><Spin indicator={ loadingIcon } tip="搜索中..."/></Menu>

优化后:

return 
<Menu className='textCenter'>
  <Menu.Item>
    <Spin indicator={ loadingIcon } tip="搜索中..."/>
  </Menu.Item>
</Menu>

Menu组件不能包含 Menu.Item SubMenu之外的其他组件

标签: 踩坑 React
版权声明:本文为作者原创文章,转载时请务必声明出处并添加指向此页面的链接。
分享:
发表评论

目前您尚未登录,请 登录 后进行评论

评论信息