test(...arg) { console.log("參數",arg); } render(){ return <View style={{flex:1,backgroundColor:"blue"}}> <TouchableOpacity activeOpacity={1} onPress={this. test("點擊執行這個函數而不是立即執行")}>//不適用箭頭函數 有沒有其他方式呢? <Text>hahahahhahahahahahha</Text> </TouchableOpacity> </View> }
ES6中不用匿名函數如何傳遞參數,而且不立即執行呢
胡子哥哥
2019-03-11 11:12:11