合集-代码片段
摘要:使用axios下载文件时,当下载出错,后端返回错误信息时,需要先通过FileReader将Blob对象转换为文本,然后将文本转换为JSON对象,最后将JSON对象中的message属性作为错误信息展示给用户。 const fileReader = new FileReader(); fileRead
阅读全文
摘要:// 节流 function throttle(fn, delay, asThis) { let timer = null; return (...args) => { if (timer) return fn.call(asThis, ...args) timer = setTimeout(()
阅读全文