为了账号安全,请及时绑定邮箱和手机立即绑定

使用函数节流之后找不到相关调用函数

使用函数节流之后找不到相关调用函数

慕莱坞森 2019-02-05 17:18:00
节流函数这么声明的,在调用的时候如果method没有带参数是可以调用$(".fundName").bind('input porpertychange', function(){        throttle(newbee, window);    })})function throttle(method, context) {    clearTimeout(method.tId);    method.tId = setTimeout(function () {        method.call(context);    }, 500);}  function newbee(){    console.log(1)}但是如果所调用的话函数有参数传递过去,在throttle里method就显示undefined$(document).ready(function(){    $(".fundName").bind('input porpertychange', function(){        throttle(newbee("1"), window);    })})function throttle(method, context) {    clearTimeout(method.tId);    method.tId = setTimeout(function () {        method.call(context);    }, 500);}function newbee(tar){    console.log(tar)}请大家指点
查看完整描述

2 回答

?
慕妹3146593

TA贡献1820条经验 获得超9个赞

入参method不是一个函数,函数执行后返回 undefined


查看完整回答
反对 回复 2019-02-27
  • 2 回答
  • 0 关注
  • 689 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号