Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/ImageCropper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export default {
}
},
data() {
let fileName
const { imgFormat, langType, langExt, width, height } = this
let isSupported = true
const allowImgFormat = ['jpg', 'png']
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -773,7 +775,8 @@ export default {
fmData.append(
field,
data2blob(createImgUrl, mime),
field + '.' + imgFormat
//field + '.' + imgFormat
this.fileName + '.' + imgFormat
)
// 添加其他参数
if (typeof params === 'object' && params) {
Expand Down