layui/package/component/es/utils/index.js
2022-11-15 09:16:55 +08:00

11 lines
385 B
JavaScript

function indentHandle(obj) {
const { indent, level, basePadding = 0, isTree } = obj;
const least = level - 1;
if (isTree && indent && least > 0) {
const px = typeof indent === "boolean" ? `${basePadding + 10 * least}px` : indent.replace(/\d+/g, (s) => (basePadding + least * +s).toString());
return `padding-left: ${px}`;
}
return "";
}
export { indentHandle as i };