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
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<li class="layui-nav-item mobile layui-hide-xs" lay-unselect>
|
||||
<a href="javascript:;" data-check-screen="full"><i class="fa fa-arrows-alt"></i></a>
|
||||
</li>
|
||||
<li class="layui-nav-item" lay-unselect>
|
||||
<li class="layui-nav-item mobile layui-hide-xs" lay-unselect>
|
||||
<div class="layui-form ws-header-theme" lay-filter="header-theme">
|
||||
<input type="checkbox" name="theme-mode" lay-filter="header-theme-mode" lay-skin="switch">
|
||||
<div lay-checkbox>
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user