#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->addNew(); li->setHtmlTagName("li"); li->addNew(Wt::WLink(Wt::LinkType::InternalPath, "/wt/login"), "登录页面"); li = ul->addNew(); li->setHtmlTagName("li"); li->addNew(Wt::WLink(Wt::LinkType::InternalPath, "/wt/task"), "任务清单"); li = ul->addNew(); li->setHtmlTagName("li"); li->addNew(Wt::WLink(Wt::LinkType::InternalPath, "/wt/visitor/analysis"), "访客数据"); li = ul->addNew(); li->setHtmlTagName("li"); li->addNew(Wt::WLink(Wt::LinkType::InternalPath, "/wt/webrtc"), "WebRTC测试"); 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"); }