2015-10-05 128 views
0

我正在創建一個擴展按鈕的組件,我正在尋找一種方法來處理Ember 1.13.0中的按鈕單擊事件。我想,下面的代碼,但沒有運氣Ember組件處理按鈕單擊

//custom-button.js 
export default Ember.Component.extend({ 

tagName: 'button', 

attributeBindings: ['autofocus', 'accesskey', 'form', 'formaction', 'formenctype', 'type', 
    'formmethod', 'formnovalidate', 'formtarget', 'name', 'value', 'contenteditable', 'contextmenu', 'dir', 
    'draggable', 'dropzone', 'hidden', 'id' ,'lang', 'spellcheck', 'style', 'tabindex', 'title', 'translate', 
    'disabled', 'role', 'targetForm'], 

type: 'button', 

click: function() { 
    alert('clicking'); 
    this.sendAction(); 
}, 

//edit.hbm 
{{mbs-custom-button class="btn btn-primary" role="button" label=(t 'action.save') action="save"}} 

回答