From 15c4810117e9216464f33fbdeee49778bd2f05f3 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 20 Aug 2023 18:48:06 +0800 Subject: [PATCH] feat: add page refresh & back to top features --- src/contentScripts/views/App.vue | 39 ++++++++++++++++++++++++++--- src/utils/main.ts | 42 ++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 6f37d41e..8347a14a 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -14,7 +14,7 @@ import Video from './Video/Video.vue' import { accessKey, activatedPage, settings } from '~/logic' import '~/styles/index.ts' import { AppPage, LanguageType } from '~/enums/appEnums' -import { getUserID, hexToRGBA } from '~/utils/main' +import { getUserID, hexToRGBA, smoothScrollToTop } from '~/utils/main' import emitter from '~/utils/mitt' const { locale } = useI18n() @@ -37,6 +37,7 @@ const isVideoPage = ref(false) const mainAppRef = ref() as Ref const mainAppOpacity = ref(0) const showTopbarMask = ref(false) +const dynamicCompoentKey = ref(Number(new Date())) const tooltipPlacement = computed(() => { if (settings.value.dockPosition === 'left') @@ -211,6 +212,14 @@ function setAppWallpaperMaskingOpacity() { else bewlyElement.style.setProperty('--bew-bg-mask-opacity', `${settings.value.wallpaperMaskOpacity}%`) } + +function handleRefresh() { + dynamicCompoentKey.value = Number(new Date()) +} + +function handleBackToTop() { + smoothScrollToTop(mainAppRef.value, 300) +}