Vaadin Flow Polymer模板

时间:2018-11-26 20:37:24

标签: spring-boot vaadin-flow

  

我对vaadin flow不熟悉,我在执行> project时正在使用Polymer Template   它发送错误NullPointerException:null,我要添加的内容缺少什么?

@Route
public class MainView extends VerticalLayout {

    public MainView(@Autowired HelloWorld2 bean) {
        add(bean);
    }

}

@Tag("hello-world")
@HtmlImport("src/components/siptec-hello-world/hello-world.html")
@Service
public class HelloWorld2 extends PolymerTemplate<HelloWorld2Model>  {

    private static final String EMPTY_NAME_GREETING = "Please enter your 
       name";

    public interface HelloWorld2Model extends TemplateModel {
        String getName();
        void setGreeting(String greeting);
}

public HelloWorld2() {
        setId("template");
        getModel().setGreeting(EMPTY_NAME_GREETING);
}


<dom-module id="hello-world">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <vaadin-text-field id="inputId" value="{{name}}" style="width: 200px"></vaadin-text-field>
    <div id="greeting">[[greeting]]</div>
  </template>

0 个答案:

没有答案