From cccc5fe0694b164b383e6a78fda0295a3515b874 Mon Sep 17 00:00:00 2001 From: 刘鸿 Date: Thu, 5 Dec 2024 13:17:05 +0800 Subject: [PATCH] fix:增加异常机制 --- src/utils/index.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 3882fe8..7391166 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -614,13 +614,18 @@ export function getBlob(url) { }); } export function fetchHTML(url) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.send(); - if (xhr.status === 200) { - return xhr.responseText; - } else { - return null; + try { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(); + if (xhr.status === 200) { + return xhr.responseText; + } else { + return ""; + } + } + catch (e) { + return ""; } } /** @@ -989,7 +994,7 @@ export function paperPrint(paper) { } // size: A4 portrait; // size: A3 landscape; - + const style = printWin.document.createElement('style'); style.innerHTML = ` @media print -- libgit2 0.21.4