【发布时间】:2021-10-27 12:29:48
【问题描述】:
我创建了一个名为“Footer”的类,它只有一个标签。我也有一些视图,例如 loginview、orderview)。我想将该页脚添加到每个视图中。这是我到现在为止的代码。
@ParentLayout(OrderView.class)
public class footer extends VerticalLayout implements RouterLayout {
public footer() {
add(new Span("This text should be underneath the page in the views"));
}
}
在您的下面有我的 orederview,我想在其中查看来自 footerclass 的文本。
@Route("order")
public class OrderView extends VerticalLayout implements RouterLayout {
public OrderView (){
// What am I supposed to code here to get that text from Footerclass.
}
}
我想知道我错过了什么。 感谢您的帮助。
【问题讨论】:
-
你的
footer()构造函数并没有真正做任何有意义的事情。 -
您应该将该标签添加到您正在扩展的布局中。
-
jmizv,这就是练习所要求的......只需在我拥有的每个视图下方添加一个文本。
-
安娜,我该怎么做?谢谢
-
只是
add(label);
标签: java vaadin vaadin-flow