pearAdmin.instances.tabPage = tabPage.render({ elem: 'content', session: param.tab.session, index: 0, tabMax: param.tab.max, preload: param.tab.preload, closeEvent: function (id) { pearAdmin.instances.menu.selectItem(id); }, data: [{ id: param.tab.index.id, url: param.tab.index.href, title: param.tab.index.title, type: param.tab.index.type,//修復 20241018 解決原來的沒有指定型別,載入頁面報錯導致後臺渲染異常 close: false }], success: function (id) { if (param.tab.session) { setTimeout(function () { pearAdmin.instances.menu.selectItem(id); pearAdmin.instances.tabPage.positionTab(); }, 500) } } });
// 不支援IE //this.configurationProvider = () => { // return new Promise((resolve) => { // if (this.configurationPath.indexOf("yml") == -1) { // $.ajax({ // type: 'get', // url: this.configurationPath, // dataType: 'json', // async: false, // success: (result) => { // resolve(result); // } // }); // } else { // resolve(yaml.load(this.configurationPath)); // } // }) //} // 修復 20241018 支援IE this.configurationProvider = (callback) => { $.ajax({ url: this.configurationPath, type: 'get', dataType: 'json', success: function (result) { // 呼叫回撥並將結果作為第二個引數 if (typeof callback === "function") { callback(null, result); } else { console.log("Callback is not a function."); } }, error: function (jqXHR, textStatus, errorThrown) { // 呼叫回撥並傳遞錯誤 if (typeof callback === "function") { callback(new Error(`Request failed: ${textStatus}`)); } else { console.log("Callback is not a function."); } } }); };
//不支援IE //this.configurationProvider().then((result) => { // pearAdmin.apply(result); //}) // 修復 20241018 支援IE this.configurationProvider((error, result) => { if (error) { console.error(error); } else { pearAdmin.apply(result); } });