feat: add fallback placeholder image

This commit is contained in:
Hufe921
2023-06-28 21:00:08 +08:00
parent d0e1c9b526
commit 366374eb10
2 changed files with 32 additions and 0 deletions
+8
View File
@@ -148,4 +148,12 @@ export function cloneProperty<T>(properties: (keyof T)[], sourceElement: T, targ
delete targetElement[property]
}
}
}
export function convertStringToBase64(input: string) {
const encoder = new TextEncoder()
const data = encoder.encode(input)
const charArray = Array.from(data, byte => String.fromCharCode(byte))
const base64 = window.btoa(charArray.join(''))
return base64
}