#include "HomePage.h" #include "Dialog.h" #include #include #include HomePage::HomePage() { addStyleClass("bulma-content"); auto p = addWidget(std::make_unique("这是一个结合 C++ Web Toolkit 和 CSS Bulma 框架的前后端一体应用程序。")); p->setInline(false); auto ul = addWidget(std::make_unique()); ul->setList(true); auto li = ul->addWidget(std::make_unique(R"(登录页面)")); li->setHtmlTagName("li"); li = ul->addWidget(std::make_unique(R"(访客数据)")); li->setHtmlTagName("li"); addWidget(std::make_unique("Your name, please ? ")); m_nameEdit = addWidget(std::make_unique()); m_nameEdit->setFocus(); auto b = addWidget(std::make_unique("点击我!")); b->setMargin(5, Wt::Side::Left); addWidget(std::make_unique()); m_greeting = addWidget(std::make_unique()); b->clicked().connect(this, &HomePage::greet); m_nameEdit->enterPressed().connect(this, &HomePage::greet); addWidget(std::make_unique()); } void HomePage::greet() { m_greeting->setText("Hello there, " + m_nameEdit->text()); Wt::WApplication::instance()->setInternalPath("/hello"); }