From 78fc82abdca5794e2aba32602802d4686fc11d6d Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 29 Jan 2023 02:18:08 +0800 Subject: [PATCH] fix: the language cannot be updated on first load --- src/contentScripts/views/App.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 024f1dc9..b366e1df 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -21,7 +21,7 @@ watch(() => activatedPage.value, (newValue, oldValue) => { window.scrollTo({ top: 0, behavior: 'smooth' }) }) -window.onload = async () => { +onUpdated(async () => { // if there is first-time load extension, set the default language by browser display language if (!language.value) { if (browser.i18n.getUILanguage() === 'zh-CN') { @@ -41,7 +41,7 @@ window.onload = async () => { } locale.value = language.value -} +}) function changeActivatePage(pageName: AppPage) { activatedPage.value = pageName