增加状态红色圆点

This commit is contained in:
BianLzhaoMin 2025-02-19 15:22:07 +08:00
parent af5087aba8
commit f03a3d69de
1 changed files with 23 additions and 0 deletions

View File

@ -4,6 +4,29 @@ function getIsCheckFun(list) {
list.forEach((e) => {
if (e.isCheck == 1) {
console.log("有待审数据", e);
let layId = `[lay-id=${e.id}]`;
var elements = document.querySelectorAll(layId);
// 遍历选中的元素
elements.forEach((element) => {
// 设置父元素相对定位
element.style.position = "relative";
// 创建一个新的 span 标签(红色圆点)
let span = document.createElement("span");
span.style.position = "absolute"; // 使用绝对定位
span.style.width = "6px"; // 圆点宽度
span.style.height = "6px"; // 圆点高度
span.style.backgroundColor = "red"; // 圆点颜色
span.style.borderRadius = "50%"; // 使其成为圆形
span.style.top = "50%"; // 垂直居中
span.style.right = "0"; // 靠右显示
span.style.transform = "translateY(-50%)"; // 调整位置,使其正好居中
// 将圆点插入到选中元素中
element.appendChild(span);
});
}
if (e.child && e.child.length > 0) {
getIsCheckFun(e.child);