mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat: auto-scroll to content below when search page mode is activated
This commit is contained in:
@@ -222,10 +222,10 @@ function handleRefresh() {
|
||||
dynamicComponentKey.value = `dynamicComponent${Number(new Date())}`
|
||||
}
|
||||
|
||||
function handleBackToTop() {
|
||||
function handleBackToTop(targetScrollTop = 0 as number) {
|
||||
const osInstance = scrollbarRef.value?.osInstance()
|
||||
|
||||
smoothScrollToTop(osInstance.elements().viewport, 300)
|
||||
smoothScrollToTop(osInstance.elements().viewport, 300, targetScrollTop)
|
||||
}
|
||||
|
||||
function handleAdaptToOtherPageStylesChange() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { HomeSubPage } from './types'
|
||||
import emitter from '~/utils/mitt'
|
||||
import { settings } from '~/logic'
|
||||
|
||||
const handleBackToTop = inject('handleBackToTop') as () => void
|
||||
const handleBackToTop = inject('handleBackToTop') as (targetScrollTop: number) => void
|
||||
|
||||
const recommendContentKey = ref<string>(`recommendContent${Number(new Date())}`)
|
||||
const activatedPage = ref<HomeSubPage>(HomeSubPage.ForYou)
|
||||
@@ -34,7 +34,7 @@ const tabs = reactive<HomeTab[]>([
|
||||
])
|
||||
|
||||
watch(() => activatedPage.value, () => {
|
||||
handleBackToTop()
|
||||
handleBackToTop(settings.value.useSearchPageModeOnHomePage ? 510 : 0)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -57,6 +57,7 @@ onUnmounted(() => {
|
||||
>
|
||||
<div
|
||||
pos="absolute left-0 top-0" w-full h-580px mb--580px bg="cover center" z-1
|
||||
pointer-events-none
|
||||
:style="{
|
||||
backgroundImage: `url(${settings.searchPageWallpaper})`,
|
||||
backgroundAttachment: settings.searchPageModeWallpaperFixed ? 'fixed' : 'unset'
|
||||
|
||||
@@ -7,7 +7,7 @@ import { LanguageType } from '~/enums/appEnums'
|
||||
|
||||
const videoList = reactive<ForYouVideoModel[]>([])
|
||||
const appVideoList = reactive<AppForYouVideoModel[]>([])
|
||||
const isLoading = ref<boolean>(false)
|
||||
const isLoading = ref<boolean>(true)
|
||||
const needToLoginFirst = ref<boolean>(false)
|
||||
const containerRef = ref<HTMLElement>() as Ref<HTMLElement>
|
||||
const refreshIdx = ref<number>(1)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { RankingType, RankingVideoModel } from '../types'
|
||||
import { settings } from '~/logic'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const handleBackToTop = inject('handleBackToTop') as () => void
|
||||
const handleBackToTop = inject('handleBackToTop') as (targetScrollTop: number) => void
|
||||
|
||||
const rankingTypes = computed((): RankingType[] => {
|
||||
return [
|
||||
@@ -41,7 +42,7 @@ const activatedRankingType = reactive<RankingType>({ ...rankingTypes.value[0] })
|
||||
const videoList = reactive<RankingVideoModel[]>([])
|
||||
|
||||
watch(() => activatedRankingType.name, () => {
|
||||
handleBackToTop()
|
||||
handleBackToTop(settings.value.useSearchPageModeOnHomePage ? 510 : 0)
|
||||
getRankingVideos()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user