1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

修改上传图片时只能使用默认名称的问题

上传图片时只能使用file指定的名称,而不能使用本地的文件名称
This commit is contained in:
Mrzls999 2024-01-10 15:38:46 +08:00 committed by GitHub
parent 0caa975ee2
commit 3716590b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,6 +225,7 @@ export default {
}
},
data() {
let fileName
const { imgFormat, langType, langExt, width, height } = this
let isSupported = true
const allowImgFormat = ['jpg', 'png']
@ -478,6 +479,7 @@ export default {
},
//
setSourceImg(file) {
this.fileName = file.name.substr(0,file.name.lastIndexOf('.'))
const fr = new FileReader()
fr.onload = e => {
this.sourceImgUrl = fr.result
@ -773,7 +775,8 @@ export default {
fmData.append(
field,
data2blob(createImgUrl, mime),
field + '.' + imgFormat
//field + '.' + imgFormat
this.fileName + '.' + imgFormat
)
//
if (typeof params === 'object' && params) {