【发布时间】:2021-06-02 22:27:26
【问题描述】:
我真的对 Vaadin 的 Tabs/Tab-component 感到困惑:
我创建了一个包含几个标签的页面,基本上是这样的:
Tabs tabs = new Tabs();
Tab tab1 = new Tab("Label 1");
tab1.add(<some components (labels and entry fields) here>);
tabs.add(tab1);
Tab tab2 = new Tab("Label 2");
tab2.add(<some components (labels and entry fields) here>);
tabs.add(tab2);
Tab tab3 = new Tab("Label 3");
tab3.add(<some components (labels and entry fields) here>);
tabs.add(tab3);
mainPage.add(tabs)
我期望得到的渲染与此类似(当然以一些样式为模):
___________ ___________ ___________
/ Label 1 \/ *Label 2* \/ Label 3 \
+----------------------------------------------------+
| Content of Tab 2 visible |
| |
| (the other tabs' contents is hidden until their |
| corresponding tab is selected ) |
| |
| |
+----------------------------------------------------+
即我有一个标记单个选项卡或“页面”的标题列表,其中只有一个的内容显示在下面。在这里,例如假设当前选择了选项卡 2,因此在下面的区域中我可以看到它的内容,而选项卡 1 和选项卡 3 的内容当前是隐藏的。
现在,Vaadin 选项卡显示如下:
[content 1] [content 2] [content 3]
Label 1 [content 1] *Label 2* [content 2] Label 3 [content 3]
[content 1] [content 2] [content 3]
[content 1] [content 2] [content 3]
-----
即每个选项卡的内容显示在相应标签旁边,所有内容同时可见。该行表示当前选择的选项卡。
这是 Tab 概念的最奇怪的实现,在我看来完全被打破了!这真的是打算这样显示吗?还是我在这里做错了什么?
【问题讨论】:
标签: vaadin vaadin-flow