feat 用户头像修改

This commit is contained in:
jxxghp
2023-07-19 18:24:47 +08:00
parent cef77f3173
commit d08692a30a

View File

@@ -44,11 +44,13 @@ const changeAvatar = (file: Event) => {
const fileReader = new FileReader();
const { files } = file.target as HTMLInputElement;
if (files && files.length) {
if (files && files.length > 0) {
fileReader.readAsDataURL(files[0]);
fileReader.onload = () => {
if (typeof fileReader.result === "string")
if (typeof fileReader.result === "string") {
accountInfo.value.avatar = fileReader.result;
saveAccountInfo();
}
};
}
};