diff --git a/vue/gold-system/src/views/managerecharge/activity.vue b/vue/gold-system/src/views/managerecharge/activity.vue index 423e2db..9156d73 100644 --- a/vue/gold-system/src/views/managerecharge/activity.vue +++ b/vue/gold-system/src/views/managerecharge/activity.vue @@ -166,7 +166,21 @@ const add = async function () { } }); }; -const throttledAdd = _.throttle(add, 5000); +// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 +const throttledAdd = _.throttle(add, 5000, { trailing: false }); +// 新增一个标志,用于控制是否执行函数 +// let onceFunction = true; +// 改进后的手动节流函数 +// const throttledAdd = (...args) => { +// if (onceFunction) { +// add.apply(null, args); +// onceFunction = false; // 执行后设置为false,表示不能再执行了 +// timer = setTimeout(() => { +// onceFunction = true; // 间隔结束后,恢复为可以执行的状态,但需要新的点击触发 +// timer = null; +// }, 1000); // 设置节流时间间隔为1000毫秒(1秒),可调整 +// } +// }; // 删除========================================================= // 删除按钮 const del = function (row) { @@ -512,7 +526,7 @@ onMounted(async function () {