我正在使用 Designer 开发 Maven,Vaadin,我无法解决为什么我的代码仍然显示“test”和“test2”,因为通过 testView2.setVisible(false) 应该隐藏“test2”标签。这是所有相关代码。希望任何人都可以提供帮助。
测试视图.java
@Tag("test-view")
@HtmlImport("src/views/kunde/test-view.html")
@Route("test")
public class TestView extends PolymerTemplate<TestView.TestViewModel> {
@Id("testView2")
private TestView2 testView2;
public TestView() {
testView2.setVisible(false);
}
public interface TestViewModel extends TemplateModel {
}
}
测试视图.html
<dom-module id="test-view"> <template>
<style include="shared-styles">
:host {
display: block;
}
</style>
<div>
<label>Label</label>
</div>
<test-view-2 id="testView2"></test-view-2>
</template> <script>
class TestView extends Polymer.Element {
static get is() {
return 'test-view';
}
static get properties() {
return {
// Declare your properties here.
};
}
}
customElements.define(TestView.is, TestView);
</script> </dom-module>
test-view-2.html
<dom-module id="test-view-2">
<template>
<style include="shared-styles">
:host {
display: block;
}
</style>
<div>
<label>test2</label>
</div>
</template>
<script>
class TestView2 extends Polymer.Element {
static get is() {
return 'test-view-2';
}
static get properties() {
return {
// Declare your properties here.
};
}
}
customElements.define(TestView2.is, TestView2);
</script>
</dom-module>