修改冀北现场反馈问题
This commit is contained in:
@@ -25,11 +25,17 @@ export const download = (urls: string) => {
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
let name=urls.split('/')[2].split('.')[0]
|
||||
let name = removeLastDotSuffix(urls.split('/')[2])
|
||||
link.href = url
|
||||
link.download = name
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
}
|
||||
}
|
||||
function removeLastDotSuffix(str: string) {
|
||||
// 找到最后一个 . 的位置
|
||||
const lastDotIndex = str.lastIndexOf('.')
|
||||
// 如果存在 .,截取到 . 之前的部分;否则返回原字符串
|
||||
return lastDotIndex !== -1 ? str.slice(0, lastDotIndex) : str
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user