[英]Ember-paper and class?
我正在使用 Ember.js 制作一個項目,我使用ember-paper
插件作為按鈕,還使用Ember-intl
插件來翻譯我的應用程序(英語和法語)。
我有一個帶有以下代碼的基本 HTML 按鈕:
<button class={{if model.active "active"}} {{action "changeLocale" model.locale}}>{{model.locale}}</button>
但是當我使用帶有這種代碼的 ember-paper 時:
{{#paper-button accent=true}}Test{{/paper-button}}
我找不到添加 if 語句和操作的方法。
{{if model.active "active"}} {{action "changeLocale" model.locale}}>
你知道怎么做嗎?
工作旋轉
1) 您可以使用{{#paper-button}}
組件內的onClick
選項調用您的action
。
2)您可以使用disabled
和accent
布爾選項根據您的條件model.active
設置true
或false
{{#paper-button
onClick=(action "someAction")
accent=true
disabled=(unless model.active true)
accent=(if model.active true)
}}
Test
{{/paper-button}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.