feat: 一些细枝末节的优化

This commit is contained in:
539943419 committed 2025-01-28 10:16:30 +08:00
1 parent 0ba17ace6f
commit 89c138cedf
2 files changed
+21 -22

No files matched your search

+1 -7
View File
@@ -30,13 +30,7 @@ const generateQRCodeCanvasData = (data: Uint8Array) => {
}
const paddingData = (data: Uint8Array) => {
if(data.length % 3 === 0) {
return new Uint8Array([...data, 0, 1, 2])
} else if(data.length % 3 === 1) {
return new Uint8Array([...data, 0, 1])
} else {
return new Uint8Array([...data, 0])
}
return new Uint8Array([...data, ...new Array(3 - data.length % 3).fill(0).map((_, i) => i)])
}
onMounted(() => {