From 969a7a5ce5bd322a1192c9fb9a2131f2bc21a906 Mon Sep 17 00:00:00 2001 From: wolfcode Date: Mon, 9 Jun 2025 14:37:58 +0800 Subject: [PATCH] fix(easy-admin): try-catch onInitElemStyle and hide theme switch on mobile - Add try-catch block around onInitElemStyle function to handle potential errors - Hide theme switch option on mobile devices to improve user experience --- app/admin/view/index/index.html | 2 +- public/static/plugs/easy-admin/easy-admin.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index ba088ed..91e7b76 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -38,7 +38,7 @@
  • -
  • +
  • diff --git a/public/static/plugs/easy-admin/easy-admin.js b/public/static/plugs/easy-admin/easy-admin.js index a88c35a..e937097 100644 --- a/public/static/plugs/easy-admin/easy-admin.js +++ b/public/static/plugs/easy-admin/easy-admin.js @@ -2,13 +2,16 @@ define(["jquery", "tableSelect", "miniTheme", "xmSelect", "lazyload"], function //切换日夜模式 window.onInitElemStyle = function () { - miniTheme.renderElemStyle(); - $('iframe').each(function (index, iframe) { - if (typeof iframe.contentWindow.onInitElemStyle == "function") { - iframe.contentWindow.onInitElemStyle(); - } - }); - miniTheme.changeThemeMainColor(); + try { + miniTheme.renderElemStyle(); + $('iframe').each(function (index, iframe) { + if (typeof iframe.contentWindow.onInitElemStyle == "function") { + iframe.contentWindow.onInitElemStyle(); + } + }); + miniTheme.changeThemeMainColor(); + } catch (e) { + } }; window.onInitElemStyle();