refactor: 重构 dropdown 打开与关闭逻辑 (#2349)

* refactor: 重构 dropdown 打开与关闭逻辑

* chore: 优化变量

* refactor: 保留采用 elem 的 jQuery Data 进行面板打开状态的判断

* fix: 优化延时移除面板时的实例不一致的问题
This commit is contained in:
贤心
2024-11-25 11:33:32 +08:00
committed by GitHub
parent 636551547b
commit 1670cbab8f
5 changed files with 147 additions and 108 deletions

View File

@@ -316,11 +316,19 @@ layui.use(['table', 'dropdown'], function(){
});
}
},
id: 'dropdown-table-tool',
align: 'right', // 右对齐弹出
style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
})
});
}
});
// table 滚动时移除内部弹出的元素
var tableInst = table.getOptions('test');
tableInst.elem.next().find('.layui-table-main').on('scroll', function() {
dropdown.close('dropdown-table-tool');
});
// 触发表格复选框选择
table.on('checkbox(test)', function(obj){