1
This commit is contained in:
@@ -210,8 +210,7 @@ class Http {
|
|||||||
let res = await axios.post(url, formData, config)
|
let res = await axios.post(url, formData, config)
|
||||||
filename = filename || res.headers['content-disposition'].split('filename=')[1].split(';')[0]
|
filename = filename || res.headers['content-disposition'].split('filename=')[1].split(';')[0]
|
||||||
|
|
||||||
// 开头和结尾去掉 中间不去掉
|
|
||||||
filename = filename.replace(/^[_-]+|[_-]+$/g, '')
|
|
||||||
|
|
||||||
// 直接下载
|
// 直接下载
|
||||||
if (is_down) {
|
if (is_down) {
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ export default class uiTool {
|
|||||||
* @param {String} fileName - 文件名(可选,默认为时间戳.csv)
|
* @param {String} fileName - 文件名(可选,默认为时间戳.csv)
|
||||||
*/
|
*/
|
||||||
static downloadFile(res, fileName) {
|
static downloadFile(res, fileName) {
|
||||||
|
// 开头和结尾去掉 中间不去掉
|
||||||
|
fileName = fileName.replace(/^[_-]+|[_-]+$/g, '')
|
||||||
|
|
||||||
const blob = new Blob([res.data || res])
|
const blob = new Blob([res.data || res])
|
||||||
const downloadElement = document.createElement('a')
|
const downloadElement = document.createElement('a')
|
||||||
const href = window.URL.createObjectURL(blob)
|
const href = window.URL.createObjectURL(blob)
|
||||||
|
|||||||
2
快速开始.md
2
快速开始.md
@@ -168,7 +168,7 @@ this.$tools.formatDate(new Date())
|
|||||||
this.$tools.deepClone(obj)
|
this.$tools.deepClone(obj)
|
||||||
|
|
||||||
// 文件下载
|
// 文件下载
|
||||||
this.$funTool.downloadFile(response, 'filename.xlsx')
|
this.$uiTool.downloadFile(response, 'filename.xlsx')
|
||||||
|
|
||||||
// 配置信息
|
// 配置信息
|
||||||
this.$config.title
|
this.$config.title
|
||||||
|
|||||||
Reference in New Issue
Block a user