在ExtJS裏面, 由於是組件化開發,涉及到作用域的時候怎麼辦?
比如一個splitbutton,在一個大panel裏面,
點擊時它的事件處理裏面,如果不寫scope,那麼傳到onPrintPDF函數裏的對象就是這個按鈕本身,
寫了scope,就是panel
let me = this;
let t_print_menu = {
xtype: 'splitbutton',
text: report.Message.print,
iconCls: "PSI-button-print",
disabled: t_print_disabled,
handler: me.onPrintPDF,
scope: me,
menu: t_print_tpl_menu,
}