楼主小萌新哭了,使用ES5怎么实现下面得代码啊
javascript吧
全部回复
仅看楼主
level 1
2020年07月31日 06点07分 1
level 1
顶
2020年07月31日 08点07分 2
level 1
[泪]
2020年07月31日 08点07分 3
level 9
es5里混着es6
2020年07月31日 08点07分 4
level 11
把()=> 改成 function()
2020年07月31日 09点07分 5
level 12
// 你的代码就箭头函数是es6 [委屈]
var handler = {
id: "123456",
init: function() {
var t = this;
document.addEventListener(
"click",
function(event) {
t.doSomething(event.type);
},
false
);
},
doSomething: function(type) {
console.log(type);
console.log("Handling " + type + " for" + this.id);
},
};
handler.init();
2020年07月31日 10点07分 6
level 12
[阴险]
2020年07月31日 10点07分 7
level 1
就箭头函数要改。没啥意思啊
2020年08月01日 00点08分 9
level 1
babel
2020年08月01日 03点08分 10
1