帮助了 AmazingCounters.com 位小伙伴

Angular2 输入完成后触发函数

(blur)="keySearch($event)" ,鼠标点击其他地方触发

   keySearch(e): void {
       var dom = $(e.target);
       var key =dom.attr('name');
       //var days = this.setData.member_card_notice_day.val;
       //key值去匹配对应的天数
       var days = $(`#${key}`).val();
       let that = this;
       this.searchTimer && clearTimeout(this.searchTimer);
       this.searchTimer = setTimeout(() => {
           that.setInput(key,days);
       }, 500);
   }

(keyup)="keySearch($event)",输入框完成后触发
    keySearch(e): void {
        var dom = $(e.target);
        var key =dom.attr('name');
        //var days = this.setData.member_card_notice_day.val;
        //key值去匹配对应的天数
        var days = $(`#${key}`).val();
        let that = this;
        this.searchTimer && clearTimeout(this.searchTimer);
        this.searchTimer = setTimeout(() => {
            that.setInput(key,days);
        }, 500);
    }

posted on 2019-09-03 17:14  云的旋律  阅读(470)  评论(0编辑  收藏  举报

导航

前端攻城狮分享群