时间戳按钮防止搜索按钮多次点击

2020-11-19  本文已影响0人  盖子pp

data里面定义一个时间戳

timer:new Date()

点击的时候去判断时间

clickBtn: function() {
 if (new Date() - this.timer < 1000) {
    return
 }
 this.timer = new Date()
 this.search()
}
search: function() {
......
}
上一篇 下一篇

猜你喜欢

热点阅读