@zjlab-fe/util 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{message as
|
|
1
|
+
import{message as t}from"antd";var n=[],e=!1;function r(r,i){i?window.open(r):(n.push(r),e||(e=!0,t.loading("文件下载中"),o()))}function o(){if(n.length>0){var r=n.shift();fetch(r).then((function(t){if(200!==(null==t?void 0:t.status))return Promise.reject({message:null==t?void 0:t.statusText});var n=document.createElement("a");n.style.display="none",document.body.appendChild(n),n.href=r,n.click(),document.body.removeChild(n)})).catch((function(){t.error("文件下载异常:".concat(r))})).finally((function(){setTimeout((function(){o()}),1e3)}))}else e=!1}function i(t){var n=t,e=t.indexOf("?");-1!==e&&(n=t.substring(0,e));var r=n.lastIndexOf(".");return n.substring(r+1)}function c(t){if(Array.isArray(t)){var n=[];return t.forEach((function(t){n.push(c(t))})),n}if("[object Object]"===Object.prototype.toString.call(t)){var e={};return Object.keys(t).forEach((function(n){e[n]=c(t[n])})),e}return"string"==typeof t?t.trim():t}export{r as downloadFile,i as getFileExt,c as trimObj};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("antd"),e=[],n=!1;function r(){if(e.length>0){var
|
|
1
|
+
"use strict";var t=require("antd"),e=[],n=!1;function r(){if(e.length>0){var i=e.shift();fetch(i).then((function(t){if(200!==(null==t?void 0:t.status))return Promise.reject({message:null==t?void 0:t.statusText});var e=document.createElement("a");e.style.display="none",document.body.appendChild(e),e.href=i,e.click(),document.body.removeChild(e)})).catch((function(){t.message.error("文件下载异常:".concat(i))})).finally((function(){setTimeout((function(){r()}),1e3)}))}else n=!1}exports.downloadFile=function(i,o){o?window.open(i):(e.push(i),n||(n=!0,t.message.loading("文件下载中"),r()))},exports.getFileExt=function(t){var e=t,n=t.indexOf("?");-1!==n&&(e=t.substring(0,n));var r=e.lastIndexOf(".");return e.substring(r+1)},exports.trimObj=function t(e){if(Array.isArray(e)){var n=[];return e.forEach((function(e){n.push(t(e))})),n}if("[object Object]"===Object.prototype.toString.call(e)){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}return"string"==typeof e?e.trim():e};
|