var headerModel=0; function createUi(html){ return fetch(html) .then(response=>response.text()) .then(htmlText=>{ return htmlText; }) } function getParam(name){ console.log(window.location.href) var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results == null) { return null; } else { return decodeURI(results[1]) || 0; } } function showImage(url, imgElement) { getHttpImage(url) .then(imageUrl => { imgElement.src = imageUrl; }) .catch(error => { console.log("Error loading image:", error); // 可以在这里设置一个默认图片或者显示错误信息 }); }