Browse Source

fix(frame-element): 添加加载失败时的提示信息

在 iframe 加载 HTML 内容失败时,依次尝试 getHTML、getFile、getFile2 方法,每个失败步骤添加对应的提示信息,便于排查加载问题
lsc 6 days ago
parent
commit
2db9c001c0
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/views/components/element/FrameElement/BaseFrameElement.vue

+ 2 - 0
src/views/components/element/FrameElement/BaseFrameElement.vue

@@ -363,11 +363,13 @@ const handleIframeLoad = async (event: Event) => {
           html = await api.getHTML(info.url)
           html = await api.getHTML(info.url)
         }
         }
         catch (_e) {
         catch (_e) {
+          message.info('getHTML 失败,尝试 getFile' + _e)
           try {
           try {
             const fd = await getFile(info.url)
             const fd = await getFile(info.url)
             if (fd?.data) html = new TextDecoder('utf-8').decode(new Uint8Array(fd.data))
             if (fd?.data) html = new TextDecoder('utf-8').decode(new Uint8Array(fd.data))
           }
           }
           catch (_e2) {
           catch (_e2) {
+            message.info('getFile 失败,尝试 getFile2' + _e2)
             try {
             try {
               const fd2 = await getFile2(info.url)
               const fd2 = await getFile2(info.url)
               if (fd2?.data) html = new TextDecoder('utf-8').decode(new Uint8Array(fd2.data))
               if (fd2?.data) html = new TextDecoder('utf-8').decode(new Uint8Array(fd2.data))