diff --git a/lib/plugin.js b/lib/plugin.js index 448065e..cc623c8 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -111,6 +111,9 @@ const setupProgress = (axios, ctx) => { } currentRequests++ + if (currentRequests === 1) { + $loading().start() + } }) axios.onResponse(response => { @@ -139,8 +142,10 @@ const setupProgress = (axios, ctx) => { if (!currentRequests) { return } - const progress = ((e.loaded * 100) / (e.total * currentRequests)) - $loading().set(Math.min(100, progress)) + if (currentRequests > 1) { + const progress = ((e.loaded * 100) / (e.total * currentRequests)) + $loading().set(Math.min(100, progress)) + } } axios.defaults.onUploadProgress = onProgress