Explorar o código

fix(useImport): 修复图片上传后未更新原始元素src的问题

确保图片上传到S3后同时更新原始元素的src属性,保持数据一致性
lsc hai 6 meses
pai
achega
8899a7f618
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      src/hooks/useImport.ts

+ 1 - 0
src/hooks/useImport.ts

@@ -1368,6 +1368,7 @@ export default () => {
                     const file = makeWhiteTransparent(el.src, `image_${Date.now()}.png`, 'image/png')
                     const url = await uploadFileToS3(file)
                     element.src = url // 替换为远程 URL
+                    el.src = url
                   }
                   catch (error) {
                     console.error('Image upload failed:', error)