|
|
@@ -1337,6 +1337,9 @@ export default () => {
|
|
|
const file = await makeWhiteTransparent(el.src, `image_${Date.now()}.png`)
|
|
|
const url = await uploadFileToS3(file)
|
|
|
element.src = url // 替换为远程 URL
|
|
|
+
|
|
|
+ const slidesStore = useSlidesStore()
|
|
|
+ slidesStore.updateElement({ id: element.id, props: { src: url } })
|
|
|
}
|
|
|
catch (error) {
|
|
|
console.error('Image upload failed:', error)
|
|
|
@@ -1362,13 +1365,16 @@ export default () => {
|
|
|
}
|
|
|
|
|
|
// 如果 src 是 base64,触发上传
|
|
|
- if (el.src && typeof el.src === 'string' && el.src.startsWith('data:')) {
|
|
|
+ if (el.picBase64 && typeof el.picBase64 === 'string' && el.picBase64.startsWith('data:')) {
|
|
|
const uploadTask = (async () => {
|
|
|
try {
|
|
|
- const file = makeWhiteTransparent(el.src, `image_${Date.now()}.png`, 'image/png')
|
|
|
+ const file = makeWhiteTransparent(el.picBase64, `image_${Date.now()}.png`, 'image/png')
|
|
|
const url = await uploadFileToS3(file)
|
|
|
element.src = url // 替换为远程 URL
|
|
|
- el.src = url
|
|
|
+
|
|
|
+ // 使用 slidesStore.updateElement 方法更新元素,确保 Vue 能够检测到变化
|
|
|
+ const slidesStore = useSlidesStore()
|
|
|
+ slidesStore.updateElement({ id: element.id, props: { src: url } })
|
|
|
}
|
|
|
catch (error) {
|
|
|
console.error('Image upload failed:', error)
|