优化头像上传参数新增文件名称
This commit is contained in:
parent
72e4cd9fb3
commit
42bb8f6445
@ -75,7 +75,8 @@ export default {
|
||||
autoCropWidth: 200, // 默认生成截图框宽度
|
||||
autoCropHeight: 200, // 默认生成截图框高度
|
||||
fixedBox: true, // 固定截图框大小 不允许改变
|
||||
outputType:"png" // 默认生成截图为PNG格式
|
||||
outputType:"png", // 默认生成截图为PNG格式
|
||||
filename: 'avatar' // 文件名称
|
||||
},
|
||||
previews: {},
|
||||
resizeHandler: null
|
||||
@ -125,6 +126,7 @@ export default {
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => {
|
||||
this.options.img = reader.result;
|
||||
this.options.filename = file.name;
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -132,7 +134,7 @@ export default {
|
||||
uploadImg() {
|
||||
this.$refs.cropper.getCropBlob(data => {
|
||||
let formData = new FormData();
|
||||
formData.append("avatarfile", data);
|
||||
formData.append("avatarfile", data, this.options.filename);
|
||||
uploadAvatar(formData).then(response => {
|
||||
this.open = false;
|
||||
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
|
||||
|
Loading…
Reference in New Issue
Block a user