onload回调从未触发。我在做什么错了?
export function fileReadAsBase64(file: File): Promise<string> {
if (!file)
return Promise.resolve("");
return new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onload = (e: any) => {
console.log(e);
resolve(reader.result.toString());
};
reader.readAsDataURL(file);
});
}