ant-design-vue/components/vc-tree/Indent.tsx

32 lines
639 B
Vue
Raw Normal View History

2021-08-17 06:36:46 +00:00
interface IndentProps {
prefixCls: string;
level: number;
isStart: boolean[];
isEnd: boolean[];
}
const Indent = ({ prefixCls, level, isStart, isEnd }: IndentProps) => {
const baseClassName = `${prefixCls}-indent-unit`;
const list = [];
for (let i = 0; i < level; i += 1) {
list.push(
<span
key={i}
class={{
[baseClassName]: true,
[`${baseClassName}-start`]: isStart[i],
[`${baseClassName}-end`]: isEnd[i],
}}
/>,
);
}
return (
<span aria-hidden="true" class={`${prefixCls}-indent`}>
{list}
</span>
);
};
export default Indent;