每当我装上肚脐的时候我就会收到警告。我不知道该怎么处理它,也不知道它意味着什么--我尝试过在没有运气的情况下添加一个家长div。根据文档,generateChildId
属性只接受函数作为输入。超级令人困惑。
全面警告:
Warning: In the context of a `<TabContainer>`, `<NavItem>`s are given generated `id` and `aria-controls` attributes for the sake of proper component accessibility. Any provided ones will be ignored. To control these attributes directly, provide a `generateChildId` prop to the parent `<TabContainer>`.
因此,navbar +选项卡完全按照预期工作。它只是不断地在控制台中抛出这个警告。
示例使用从这里开始,示例代码:
<Tab.Container id="tabs-with-dropdown" defaultActiveKey="first">
<Row className="clearfix">
<Col sm={12}>
<Nav bsStyle="tabs">
<NavItem eventKey="first">
Tab 1
</NavItem>
<NavItem eventKey="second">
Tab 2
</NavItem>
<NavDropdown eventKey="3" title="Dropdown" id="nav-dropdown-within-tab">
<MenuItem eventKey="3.1">Action</MenuItem>
<MenuItem eventKey="3.2">Another action</MenuItem>
<MenuItem eventKey="3.3">Something else here</MenuItem>
<MenuItem divider />
<MenuItem eventKey="3.4">Separated link</MenuItem>
</NavDropdown>
</Nav>
</Col>
<Col sm={12}>
<Tab.Content animation>
<Tab.Pane eventKey="first">
Tab 1 content
</Tab.Pane>
<Tab.Pane eventKey="second">
Tab 2 content
</Tab.Pane>
<Tab.Pane eventKey="3.1">
Tab 3.1 content
</Tab.Pane>
<Tab.Pane eventKey="3.2">
Tab 3.2 content
</Tab.Pane>
<Tab.Pane eventKey="3.3">
Tab 3.3 content
</Tab.Pane>
<Tab.Pane eventKey="3.4">
Tab 3.4 content
</Tab.Pane>
</Tab.Content>
</Col>
</Row>
</Tab.Container>
);
搜索此警告几乎没有提供任何信息。
发布于 2017-04-21 13:50:30
我认为这是因为您为NavDropdown
元素提供了一个NavDropdown
。
该警告可能显示了错误的消息,因为它不期望像Nav
的子项这样的项。
顺便说一句:为什么不把它包装在NavItem
里呢?
https://stackoverflow.com/questions/43543025
复制相似问题