【问题标题】:How to make a button disabled by condition in emblem.js?如何在会徽.js中按条件禁用按钮?
【发布时间】:2016-12-28 00:40:16
【问题描述】:

我正在尝试使用 Emblem.js 使按钮按条件禁用。我已经尝试过了,它成功了:

if session.isAuthenticated
  button.ui.large.button.primary click='logout' Logout
else
  button.ui.large.button.primary disabled='true' click='logout' Logout

但我不能让它发生在一行中。我试过这些都没有成功:

button.ui.large.button.primary{bind-attr disabled="session.isAuthenticated"} click='logout' Logout

button.ui.large.button.primary disabled=session.isAuthenticated click='logout' Logout

button.ui.large.button.primary disabled="{{session.isAuthenticated}}" click='logout' Logout

不知道有没有捷径可以做到这一点?

【问题讨论】:

    标签: ember.js emblem.js


    【解决方案1】:

    这应该可行:

    button disabled={if session.isAuthenticated false true}
    

    【讨论】:

      猜你喜欢
      • 2014-10-14
      • 2021-08-31
      • 1970-01-01
      • 2021-09-11
      • 2019-02-27
      • 2021-09-28
      • 2021-01-06
      • 2013-01-27
      相关资源
      最近更新 更多