From 89e4a68a03a1ebd2ae24590baec3fff8a87d7cb7 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 8 Apr 2025 17:43:20 +0800 Subject: [PATCH] feat: add ScrollToTopBtn component and integrate it into multiple pages - Added ScrollToTopBtn component for smooth scrolling to the top of the page. - Registered ScrollToTopBtn in main.ts. - Integrated ScrollToTopBtn into browse.vue, discover.vue, recommend.vue, resource.vue pages. - Updated components.d.ts to include ScrollToTopBtn type definition. - Refactored MediaCard.vue and SlideView.vue for improved hover effects and styling. - Cleaned up unused styles and optimized existing styles for better performance and readability. --- components.d.ts | 1 + src/@core/components/ScrollToTopBtn.vue | 62 ++++ src/components/cards/MediaCard.vue | 16 +- src/components/slide/SlideView.vue | 153 ++++----- src/main.ts | 2 + src/pages/browse.vue | 1 + src/pages/discover.vue | 3 + src/pages/recommend.vue | 392 +++++++++--------------- src/pages/resource.vue | 124 ++++---- 9 files changed, 351 insertions(+), 403 deletions(-) create mode 100644 src/@core/components/ScrollToTopBtn.vue diff --git a/components.d.ts b/components.d.ts index 0a78afc2..2d18ee3b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -14,6 +14,7 @@ declare module 'vue' { MoreBtn: typeof import('./src/@core/components/MoreBtn.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + ScrollToTopBtn: typeof import('./src/@core/components/ScrollToTopBtn.vue')['default'] StatIcon: typeof import('./src/@core/components/StatIcon.vue')['default'] ThemeSwitcher: typeof import('./src/@core/components/ThemeSwitcher.vue')['default'] } diff --git a/src/@core/components/ScrollToTopBtn.vue b/src/@core/components/ScrollToTopBtn.vue new file mode 100644 index 00000000..f0b9f088 --- /dev/null +++ b/src/@core/components/ScrollToTopBtn.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/src/components/cards/MediaCard.vue b/src/components/cards/MediaCard.vue index b907f989..bb02ca12 100644 --- a/src/components/cards/MediaCard.vue +++ b/src/components/cards/MediaCard.vue @@ -431,7 +431,7 @@ function onRemoveSubscribe() { :width="props.width" class="outline-none shadow ring-gray-500 media-card" :class="{ - 'transition transform-cpu duration-300 -translate-y-1 shadow-lg': hover.isHovering, + 'transition transform-cpu duration-300 -translate-y-1': hover.isHovering, 'ring-1': isImageLoaded, }" @click.stop="goMediaDetail(hover.isHovering ?? false)" @@ -450,7 +450,7 @@ function onRemoveSubscribe() { - + - - diff --git a/src/components/slide/SlideView.vue b/src/components/slide/SlideView.vue index 389fe835..36e2b6fd 100644 --- a/src/components/slide/SlideView.vue +++ b/src/components/slide/SlideView.vue @@ -1,9 +1,5 @@