| | |
| | | * @Descripttion: 工具集 |
| | | * @version: 1.2 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-11-10 18:49:52 |
| | | * @LastEditTime: 2024-12-18 15:11:50 |
| | | */ |
| | | |
| | | import CryptoJS from 'crypto-js'; |
| | |
| | | return `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`; |
| | | }).join('&'); |
| | | } |
| | | |
| | | // 下载文件 |
| | | tool.downFile = function(link,fileName) { |
| | | const x = new XMLHttpRequest(); |
| | | x.open('GET', link, true); |
| | | x.responseType = 'blob'; |
| | | x.onload = function () { |
| | | const url = window.URL.createObjectURL(x.response); |
| | | const a = document.createElement('a'); |
| | | a.href = url; |
| | | a.download = fileName; |
| | | a.click(); |
| | | } |
| | | x.send(); |
| | | } |
| | | export default tool |