methods: {
findOther(e) {
if (e.parentNode.className == "other") {
return e.parentNode;
} else {
this.findOther(e.parentNode);
}
},
targetClass(e) {
this.num++;
onsole.log(this.findOther(e));
// cthis.findOther(e, data => {
// c console.log(data);
// c});
}
}
我得代码如上,targetClass无法获得findOther函数中返回的值,
尝试过使用callback的方法,但是仍提示错误
还望指点迷津,谢谢!
else 用的是递归,但没有 return 关键字。