1

我不确定这是否是 blueprintjs 特定的行为(也是新的反应),但我无法找到一种方法来在渲染后将内容加载到选项卡中。我认为“保持安装”是反应术语。

<Tabs id="mainNavbar" selectedTabId={this.state.mainNavbarTabId} renderActiveTabPanelOnly={true}
     onChange={this.handleNavbarTabChange}>
  <Tab id="tabOne" title="Tab One" panel={<TabOnePanel/>}/>
  <Tab id="tabTwo" title="Tab Two" panel={<TabTwoPanel/>}/>
</Tabs>

是在 render() 中使用“alreadyRendered”标志的技术吗?请问您能提出一个解决方案吗?

4

1 回答 1

0

根据文档,您应该设置renderActiveTabPanelOnlyfalse(这是默认值)。这将使其保持安装状态。根据文档:

"Whether inactive tab panels should be removed from the DOM and unmounted in React.
This can be a performance enhancement when rendering many complex panels, 
but requires careful support for unmounting and remounting."

[ https://blueprintjs.com/docs/#core/components/tabs ]

于 2020-09-17T14:08:52.990 回答