打开登录弹窗或在按钮按下时触发事件

感谢分享您的代码 :+1:

如果您希望登录/注册弹窗直接显示,那么需要使用内置的 showLoginshowCreateAccount 操作。

因此,与其使用这段代码:

helper.h(
  "button.btn-primary.btn",
  { type: "button" },
  helper.h(
    "a",
    { href: "/signup" },
    helper.h("span.d-button-label", "Tham Gia")
  )
)

对于注册弹窗,您应该使用类似以下的代码:

helper.attach("button", {
  label: "sign_up",
  className: "btn-primary btn-small sign-up-button",
  action: "showCreateAccount"
})

如果您需要的是登录弹窗,则可以使用:

helper.attach("button", {
  label: "log_in",
  className: "btn-primary btn-small login-button",
  action: "showLogin",
  icon: "user"
})

另外我想指出,我认为在每篇帖子下方为匿名用户添加带有注册/登录按钮的横幅是非常不友好的用户体验,我不建议这样做。不过,我对您的具体使用场景了解有限。您是否考虑过将横幅或图片放在网站顶部,而不是添加到每篇帖子中?