ItemNode.ts 502 B

1234567891011121314151617181920212223
  1. import { IPage } from '~/interfaces/page';
  2. type IPageForItem = Partial<IPage> & {isTarget?: boolean};
  3. export class ItemNode {
  4. page: IPageForItem;
  5. children?: ItemNode[];
  6. isPartialChildren?: boolean;
  7. constructor(page: IPageForItem, children: ItemNode[] = [], isPartialChildren = false) {
  8. this.page = page;
  9. this.children = children;
  10. this.isPartialChildren = isPartialChildren;
  11. }
  12. hasChildren(): boolean {
  13. return this.children != null && this.children?.length > 0;
  14. }
  15. }