From f3ef88e0f384d16a1f11136cab048d0aba35d315 Mon Sep 17 00:00:00 2001 From: wzrove <88016243+wzrove@users.noreply.github.com> Date: Tue, 13 Dec 2022 11:30:44 +0800 Subject: [PATCH] fix: the global search keyboard event is not removed when the component is unmounted (#767) #### What type of PR is this? /kind bug #### What this PR does / why we need it: ![image](https://user-images.githubusercontent.com/88016243/207133131-aa2404b1-c9d3-49fc-a1a7-949dd557e30c.png) #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/2927 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note None ``` --- src/layouts/BasicLayout.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/BasicLayout.vue b/src/layouts/BasicLayout.vue index c60e3401..45a204c5 100644 --- a/src/layouts/BasicLayout.vue +++ b/src/layouts/BasicLayout.vue @@ -81,7 +81,7 @@ onMounted(() => { }); onUnmounted(() => { - document.addEventListener("keydown", handleGlobalSearchKeybinding); + document.removeEventListener("keydown", handleGlobalSearchKeybinding); }); // Generate menus by routes