mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
perf: 优化账号设置-头像上传功能
This commit is contained in:
parent
d203222acf
commit
ada3e80c7e
@ -13,7 +13,7 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const imgSrc = ref("");
|
const imgSrc = ref("");
|
||||||
const cropperInfo = ref();
|
const cropperBlob = ref();
|
||||||
const cropRef = ref();
|
const cropRef = ref();
|
||||||
const uploadRef = ref();
|
const uploadRef = ref();
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
@ -66,11 +66,11 @@ const handleClose = () => {
|
|||||||
isShow.value = false;
|
isShow.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCropper = info => (cropperInfo.value = info);
|
const onCropper = ({ blob }) => (cropperBlob.value = blob);
|
||||||
|
|
||||||
const handleSubmitImage = () => {
|
const handleSubmitImage = () => {
|
||||||
const formData = createFormData({
|
const formData = createFormData({
|
||||||
files: new File([cropperInfo.value], "avatar")
|
files: new File([cropperBlob.value], "avatar")
|
||||||
});
|
});
|
||||||
formUpload(formData)
|
formUpload(formData)
|
||||||
.then(({ success, data }) => {
|
.then(({ success, data }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user