Commit 47b8f6a4 by 无尘

feat: 增加防抖

parent ef72cc02
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title></title><link href=css/chunk-22470e30.9fc010f7.css rel=prefetch><link href=css/chunk-365b3b2c.ae91f878.css rel=prefetch><link href=css/chunk-5a5b396e.338bd6d5.css rel=prefetch><link href=css/chunk-6772cdc3.1634cccf.css rel=prefetch><link href=css/chunk-6ec92bd0.3cba777f.css rel=prefetch><link href=css/chunk-8ba63460.244ad228.css rel=prefetch><link href=js/chunk-22470e30.0cc361b7.js rel=prefetch><link href=js/chunk-365b3b2c.74afe703.js rel=prefetch><link href=js/chunk-5a5b396e.595e58bc.js rel=prefetch><link href=js/chunk-6772cdc3.4f460a77.js rel=prefetch><link href=js/chunk-6ec92bd0.6f3667d0.js rel=prefetch><link href=js/chunk-8ba63460.40418c7a.js rel=prefetch><link href=css/app.bd3aa437.css rel=preload as=style><link href=js/app.c859b898.js rel=preload as=script><link href=js/chunk-vendors.dfa201dc.js rel=preload as=script><link href=css/app.bd3aa437.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.dfa201dc.js></script><script src=js/app.c859b898.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title></title><link href=css/chunk-22470e30.9fc010f7.css rel=prefetch><link href=css/chunk-365b3b2c.ae91f878.css rel=prefetch><link href=css/chunk-5a5b396e.338bd6d5.css rel=prefetch><link href=css/chunk-6772cdc3.1634cccf.css rel=prefetch><link href=css/chunk-6ec92bd0.3cba777f.css rel=prefetch><link href=css/chunk-8ba63460.244ad228.css rel=prefetch><link href=js/chunk-22470e30.aa1d4df9.js rel=prefetch><link href=js/chunk-365b3b2c.fbeaa764.js rel=prefetch><link href=js/chunk-5a5b396e.999c12d0.js rel=prefetch><link href=js/chunk-6772cdc3.84cd7310.js rel=prefetch><link href=js/chunk-6ec92bd0.6f3667d0.js rel=prefetch><link href=js/chunk-8ba63460.40418c7a.js rel=prefetch><link href=css/app.bd3aa437.css rel=preload as=style><link href=js/app.85cbba1e.js rel=preload as=script><link href=js/chunk-vendors.dfa201dc.js rel=preload as=script><link href=css/app.bd3aa437.css rel=stylesheet></head><body><div id=app></div><script src=js/chunk-vendors.dfa201dc.js></script><script src=js/app.85cbba1e.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -72,13 +72,13 @@ function timeToDate(timestamp, sym) { ...@@ -72,13 +72,13 @@ function timeToDate(timestamp, sym) {
} }
// 防抖 // 防抖
function debounce(fn, delay) { function debounce(fn, delayS) {
var delay = delay || 200; let delay = delayS || 200;
var timer; let timer;
// console.log(fn) // console.log(fn)
return function () { return function () {
var that = this; let that = this;
var args = arguments; let args = arguments;
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
} }
...@@ -89,14 +89,14 @@ function debounce(fn, delay) { ...@@ -89,14 +89,14 @@ function debounce(fn, delay) {
}; };
} }
// 节流 // 节流
function throttle(fn, interval) { function throttle(fn, intervals) {
var last; let last;
var timer; let timer;
var interval = interval || 200; let interval = intervals || 200;
return function () { return function () {
var that = this; let that = this;
var args = arguments; let args = arguments;
var now = +new Date(); let now = +new Date();
if (last && now - last < interval) { if (last && now - last < interval) {
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(function () { timer = setTimeout(function () {
......
...@@ -275,7 +275,7 @@ export default { ...@@ -275,7 +275,7 @@ export default {
/** /**
* 签到 * 签到
*/ */
toSign: publicMethod.debounce(function(e) { toSign: publicMethod.debounce(function() {
const that = this; const that = this;
if (that.userData.signFlag) { if (that.userData.signFlag) {
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment