From af28624fa9d883fb508710f80c3db8946feaa6e2 Mon Sep 17 00:00:00 2001 From: nuintun Date: Sun, 19 May 2024 19:38:22 +0800 Subject: [PATCH] feat: Update code --- app/js/utils/Queue.ts | 15 +++++---------- app/js/utils/menus.ts | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/js/utils/Queue.ts b/app/js/utils/Queue.ts index 58e58803..4bb91970 100644 --- a/app/js/utils/Queue.ts +++ b/app/js/utils/Queue.ts @@ -4,7 +4,6 @@ interface Node { value: T; - prev: Node | null; next: Node | null; } @@ -17,17 +16,15 @@ export class Queue { /** * @method enqueue - * @description 入列 + * @description 入列O * @param value 要入列的值 */ enqueue(value: T): void { const self = this; const { tail } = self; - const node: Node = { value, - next: null, - prev: tail + next: null }; if (tail) { @@ -50,14 +47,12 @@ export class Queue { if (head) { const { next } = head; - if (next) { - next.prev = null; - } else { + self.head = next; + + if (!next) { self.tail = next; } - self.head = next; - return head.value; } } diff --git a/app/js/utils/menus.ts b/app/js/utils/menus.ts index 01a1b496..701b5769 100644 --- a/app/js/utils/menus.ts +++ b/app/js/utils/menus.ts @@ -111,7 +111,7 @@ export function parse( const { meta, children } = node; const { key, name, icon, link } = meta; const isLayout = children ? children.length > 0 : false; - const parentMenu = parent ? mapping.get(parent.meta.key) : null; + const parentMenu = parent ? mapping.get(parent.meta.key) : parent; if (!name || guards.get(key) === Filter.REMOVE_SELF) { if (isLayout && parentMenu) {