Merge pull request #7 from liupengfeicode/master

完善data-tips-text支持自定义颜色data-tips-color
This commit is contained in:
邹景立 2025-03-31 23:03:27 +08:00 committed by GitHub
commit 5e8aa8845a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1006,7 +1006,9 @@ $(function () {
/*! 注册 data-tips-text 事件行为 */
$.base.onEvent('mouseenter', '[data-tips-text]', function () {
let opts = {tips: [$(this).attr('data-tips-type') || 3, '#78BA32'], time: 0};
// 获取自定义颜色(优先取 data-tips-color否则用默认色
const color = $(this).attr('data-tips-color') || '#78BA32';
let opts = {tips: [$(this).attr('data-tips-type') || 3, color], time: 0};
let layidx = layer.tips($(this).attr('data-tips-text') || this.innerText, this, opts);
$(this).off('mouseleave').on('mouseleave', function () {
setTimeout("layer.close('" + layidx + "')", 100);