Explorar o código

Merge branch 'bug6743' into debug

ldong hai 2 semanas
pai
achega
fa9f9b80c8
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/mixins/index.js

+ 3 - 2
src/mixins/index.js

@@ -141,6 +141,7 @@ const mixins = {
 			const b=new http.Base64() 
 			const arr=url.split('/')
 			const _fileName=arr[arr.length-1]
+			const _fileType= _fileName.substring(_fileName.lastIndexOf(".") + 1)
 			const fileNameTypeArr = fileName.split('.')
 			const _fileNameTypeArr = _fileName.split('.')
 			const fileNameType = fileNameTypeArr.length>1?fileNameTypeArr[fileNameTypeArr.length-1]:''
@@ -160,7 +161,7 @@ const mixins = {
 				const blob = new Blob([content])
 				if ('download' in document.createElement('a')) {
 					const elink = document.createElement('a')
-					elink.download = fileNameType?fileName:(fileName+'.'+_fileNameType)
+					elink.download = fileName+'.'+_fileType
 					elink.style.display = 'none'
 					elink.href = window.URL.createObjectURL(blob)
 					document.body.appendChild(elink)
@@ -168,7 +169,7 @@ const mixins = {
 					window.URL.revokeObjectURL(elink.href)
 					document.body.removeChild(elink)
 				} else {
-					navigator.msSaveBlob(blob, fileNameType?fileName:(fileName+'.'+_fileNameType))
+					navigator.msSaveBlob(blob, fileName+'.'+_fileType)
 				}
 				successCb&&successCb()
 			}).catch(()=>{