style: pear admin layui 更新到 4.0 正式版

This commit is contained in:
zhengxinonly
2023-11-26 00:51:02 +08:00
parent 3086c1a1fa
commit 2ffddda02b
18 changed files with 3689 additions and 3044 deletions
+34 -2
View File
@@ -130,6 +130,8 @@ layui.define(
/**
* @since Pear Admin 4.0
*
* 菜单搜索
*/
this.menuSearchRender = function (options) {
menuSearch.render({
@@ -171,6 +173,11 @@ layui.define(
});
};
/**
* @since Pear Admin 4.0
*
* 消息中心
*/
this.messageCenterRender = function (options) {
messageCenter.render({
elem: ".message",
@@ -184,6 +191,11 @@ layui.define(
$(".layui-logo .title").html(param.logo.title);
};
/**
* @since Pear Admin 4.0
*
* 侧边菜单
*/
this.menuRender = function (param) {
sideMenu = menu.render({
elem: "sideMenu",
@@ -210,6 +222,11 @@ layui.define(
});
};
/**
* @since Pear Admin 4.0
*
* 视图容器
*/
this.bodyRender = function (param) {
body.on("click", ".refresh", function () {
refresh();
@@ -312,6 +329,11 @@ layui.define(
document.documentElement.style.setProperty(variableKey, variableVal);
};
/**
* @since Pear Admin 4.0
*
* 主题配置
*/
this.themeRender = function (option) {
if (option.theme.allowCustom === false) {
$(".setting").remove();
@@ -415,10 +437,10 @@ layui.define(
var footerDOM = $(".pear-admin .layui-footer");
if (footer === true || footer === "true") {
footerDOM.removeClass("close");
bodyDOM.css("bottom", footerDOM.outerHeight());
bodyDOM.css("height", "calc(100% - 105px)");
} else {
footerDOM.addClass("close");
bodyDOM.css("bottom", "");
bodyDOM.css("height", "calc(100% - 60px)");
}
};
@@ -466,6 +488,11 @@ layui.define(
};
})();
/**
* @since Pear Admin 4.0
*
* 页面刷新
*/
function refresh() {
var refreshA = $(".refresh a");
refreshA.removeClass("layui-icon-refresh-1");
@@ -488,6 +515,11 @@ layui.define(
}, 600);
}
/**
* @since Pear Admin 4.0
*
* 菜单折叠
*/
function collapse() {
sideMenu.collapse();
var admin = $(".pear-admin");
+3 -62
View File
@@ -358,7 +358,6 @@ layui.define(["table", "jquery", "element"], function (exports) {
}
}
element.init();
downShow(option);
option.done();
}
@@ -368,7 +367,9 @@ layui.define(["table", "jquery", "element"], function (exports) {
option.theme +
'"><ul lay-filter="' +
option.elem +
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree">';
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree" ' +
(option.accordion ? "lay-accordion" : "") +
">";
$.each(option.data, function (i, item) {
var content = '<li class="layui-nav-item" >';
if (i == option.defaultOpen) {
@@ -684,66 +685,6 @@ layui.define(["table", "jquery", "element"], function (exports) {
return content;
}
function downShow(option) {
$("body #" + option.elem).on("click", "a[menu-type='0']", function () {
if (!$("#" + option.elem).is(".pear-nav-mini")) {
var superEle = $(this).parent();
var ele = $(this).next(".layui-nav-child");
var heights = ele.children("dd").length * 48;
if ($(this).parent().is(".layui-nav-itemed")) {
if (option.accordion) {
var currentDom = $(this)
.parent()
.siblings(".layui-nav-itemed")
.children(".layui-nav-child");
currentDom.animate(
{
height: "0px",
},
240,
function () {
currentDom.css({
height: "auto",
});
$(this).parent().removeClass("layui-nav-itemed");
$(this)
.find(".layui-nav-itemed")
.removeClass("layui-nav-itemed");
},
);
}
ele.height(0);
ele.animate(
{
height: heights + "px",
},
240,
function () {
ele.css({
height: "auto",
});
},
);
} else {
$(this).parent().addClass("layui-nav-itemed");
ele.animate(
{
height: "0px",
},
240,
function () {
ele.css({
height: "auto",
});
$(this).parent().removeClass("layui-nav-itemed");
},
);
}
}
});
}
/** 二 级 悬 浮 菜 单*/
function isHoverMenu(b, option) {
if (b) {
+7 -6
View File
@@ -121,16 +121,17 @@ layui.define(["jquery", "tools"], function (exports) {
});
// 监听键盘事件
$(document)
$(".menu-search-content")
.off("keydown")
.keydown(function (e) {
if (e.keyCode === 13 || e.keyCode === 32) {
e.preventDefault();
var id = $(this).attr("smenu-id");
var title = $(this).attr("smenu-title");
var url = $(this).attr("smenu-url");
var type = $(this).attr("smenu-type");
var openType = $(this).attr("smenu-open-type");
var that = $(".menu-search-list li.this");
var id = that.attr("smenu-id");
var title = that.attr("smenu-title");
var url = that.attr("smenu-url");
var type = that.attr("smenu-type");
var openType = that.attr("smenu-open-type");
options.select({ id, title, url, type, openType });
+1 -3
View File
@@ -78,7 +78,7 @@ layui.define(["jquery", "element", "dropdown"], function (exports) {
);
dropdown.render({
elem: `#${option.elem} .layui-icon-down`,
elem: `#${option.elem} .layui-tab-control > .layui-icon-down`,
trigger: "hover",
data: [
{
@@ -580,7 +580,6 @@ layui.define(["jquery", "element", "dropdown"], function (exports) {
*/
function createTab(option) {
var type = "";
var types = option.type + " ";
if (option.roll == true) {
type = "layui-tab-roll";
}
@@ -592,7 +591,6 @@ layui.define(["jquery", "element", "dropdown"], function (exports) {
}
var tab =
'<div class="pear-tab-page ' +
types +
type +
' layui-tab" lay-filter="' +
option.elem +
+1 -1
View File
@@ -8,7 +8,7 @@ window.rootPath = (function (src) {
layui
.config({
base: rootPath + "module/",
version: "4.0.0-alpha.1",
version: "4.0.0",
})
.extend({
admin: "admin",