使用ES6的時候,用class創建組件,class中的方法并不會自動把this綁定到示例中,針對以上,有以下幾種方法來進行綁定1:使用.bind(this)2:使用箭頭函數 =>3:將綁定方法寫到constructor中