优化 colorpicker 的 `id` 属性取值优先级

pull/1216/head
贤心 2023-03-19 23:22:39 +08:00
parent c9df4095f4
commit 15e23d37e5
1 changed files with 4 additions and 2 deletions

View File

@ -222,8 +222,10 @@ layui.define(['jquery', 'lay'], function(exports){
that.elemColorBox = elemColorBox that.elemColorBox = elemColorBox
); );
//初始化 id 参数 // 初始化 id 属性 - 优先取 options > 元素 id > 自增索引
options.id = ('id' in options) ? options.id : that.index; options.id = 'id' in options ? options.id : (
elem.attr('id') || that.index
);
// 获取背景色值 // 获取背景色值
that.color = that.elemColorBox.find('.'+ PICKER_TRIG_SPAN)[0].style.background; that.color = that.elemColorBox.find('.'+ PICKER_TRIG_SPAN)[0].style.background;