VUE中使用lodash的debounce和throttle方法

说明:

debounce和throttle在脚手架的使用,此处以防抖函数debounce为例避免按钮被重复点击

引入:

import lodash from 'lodash'

使用:

直接使用debounce方法

//  审核
      audit: lodash.debounce(function() {
          this.$refs['model'].saveTotalResult(1).then(() => {
            const reportId = this.activeReport.id;
            report.audit(reportId).then(res => {
                 successMsg(res.msg)
            })
          })
        }, 300),
原文地址:https://www.cnblogs.com/vickylinj/p/14379171.html