fix load image

This commit is contained in:
2026-08-08 00:32:29 +07:00
parent b3c51ff4de
commit c17f91b903
4 changed files with 15 additions and 6 deletions
+11 -2
View File
@@ -2,7 +2,7 @@
import { Settings } from '@vicons/carbon'
import { Icon } from '@vicons/utils'
import { NButton, type UploadFileInfo, useMessage } from 'naive-ui'
import { NAlert, NCard, NFlex, NInput, NModal, NSpace, NTag,NText, NUpload, NUploadDragger } from 'naive-ui'
import { NAlert, NCard, NFlex, NInput, NModal, NSpace, NTag, NText, NUpload, NUploadDragger } from 'naive-ui'
import { ref } from 'vue'
import { useRoute } from 'vue-router'
@@ -155,11 +155,20 @@ async function updateScenario() {
function uint8ToBase64(uint8Array: Uint8Array) {
// Преобразуем Uint8Array в двоичную строку
const binaryString = String.fromCharCode(...uint8Array)
const binaryString = fromCharCodeSafe(uint8Array)
// Кодируем в Base64
return btoa(binaryString)
}
function fromCharCodeSafe(arr: Uint8Array) {
let result = '';
for (let i = 0; i < arr.length; i += 50000) {
const chunk = arr.slice(i, i + 50000);
result += String.fromCharCode(...chunk);
}
return result;
}
const code = ref('')
const name = ref('')
const text = ref('')