新增 dropdown 对 `data` 的 `disabled` 属性支持

pull/1210/head
贤心 2023-03-10 13:16:33 +08:00
parent 82d050a8f9
commit c968ab358d
2 changed files with 6 additions and 1 deletions

View File

@ -1120,6 +1120,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-menu-body-title a{padding: 5px 15px; color: initial}
.layui-menu li{position: relative; margin: 1px 0; width: calc(100% + 1px); line-height: 26px; color: rgba(0,0,0,.8); font-size: 14px; white-space: nowrap; cursor: pointer; transition: all .3s;}
.layui-menu li:hover{background-color: #f8f8f8; }
.layui-menu li.layui-disabled,
.layui-menu li.layui-disabled *{background: none !important; color: #d2d2d2 !important; cursor: not-allowed !important;}
.layui-menu-item-parent:hover>.layui-menu-body-panel{display: block; animation-name: layui-fadein; animation-duration: 0.3s; animation-fill-mode: both; animation-delay:.2s;}
.layui-menu-item-parent .layui-menu-body-title,

View File

@ -179,7 +179,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
if(isChild || type){
return ' class="'+ className[type] +'"';
}
return '';
return item.disabled ? ' class="'+ STR_DISABLED +'"' : '';
}() +'>'
//标题区
@ -274,6 +274,9 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
var isChild = data.child && data.child.length > 0;
var isClickAllScope = options.clickScope === 'all'; // 是否所有父子菜单均触发点击事件
if(data.disabled) return; // 菜单项禁用状态
// 普通菜单项点击后的回调及关闭面板
if((!isChild || isClickAllScope) && data.type !== '-'){
var ret = typeof options.click === 'function' && options.click(data, othis);
ret === false || (isChild || that.remove());