From 3c29baff3a510074ede468f7249ef16c86673d4d Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 9 Jul 2023 20:13:49 +0800 Subject: [PATCH] theme-switch --- lib/global.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/global.js b/lib/global.js index 21e215da..95c9614a 100644 --- a/lib/global.js +++ b/lib/global.js @@ -105,9 +105,8 @@ const initTheme = () => { if (elements?.length > 1) { elements[elements.length - 1].scrollIntoView() // 删除前面的元素,只保留最后一个元素 - elements[0].parentNode.removeChild(elements[0]) - if (Object.prototype.hasOwnProperty.call(elements, 'pop')) { - elements.pop() + for (let i = 0; i < elements.length - 1; i++) { + elements[i].parentNode.removeChild(elements[i]) } } }, 500)