export default {
  data() {
    return {
      debounceTimer: null,
    }
  },
  methods: {
    // 按钮防抖节流
    debounceMethods(func, ...args) {
      let context = this;
      if (this.debounceTimer) clearTimeout(this.debounceTimer);
      let callNow = !this.debounceTimer; //是否立即执行
      this.debounceTimer = setTimeout(() => {
        this.debounceTimer = null;
      }, 3000)
      if (callNow) func.apply(context, args)
    }
  }
}