feat(layout): 重构页面布局与音乐播放组件
将 PlayMusic 组件迁移至 layout/RightButton 并重构成通用右下角按钮组件, 提取音乐播放逻辑到独立 hook `usePlayMusic`,优化模态框提示逻辑并统一滚动行为。
This commit is contained in:
@@ -1,32 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { useScroll } from '@vueuse/core'
|
||||
// import Header from './Header/index.vue';
|
||||
// import Footer from './Footer/index.vue';
|
||||
import { ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import CustomModal from '@/components/Dialog/index.vue'
|
||||
import { Loading } from '@/components/Loading'
|
||||
import ToTop from '@/components/ToTop/index.vue'
|
||||
import RightButton from './RightButton/index.vue'
|
||||
import { useMounted } from './useMounted'
|
||||
|
||||
const tipDialog = ref()
|
||||
const { tipDesc } = useMounted(tipDialog)
|
||||
const { t } = useI18n()
|
||||
const mainContainer = ref<HTMLElement | null>(null)
|
||||
const { y } = useScroll(mainContainer)
|
||||
|
||||
function scrollToTop() {
|
||||
y.value = 0
|
||||
mainContainer.value?.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-screen">
|
||||
<!-- <header class="shadow-2xl head-container h-14">
|
||||
<Header></Header>
|
||||
</header> -->
|
||||
<Loading />
|
||||
<ToTop v-if="y > 400" @click="scrollToTop" />
|
||||
<main ref="mainContainer" class="box-content w-screen h-screen overflow-x-hidden overflow-y-auto main-container">
|
||||
<router-view class="h-full main-container-content" />
|
||||
</main>
|
||||
<!-- <footer class="w-screen footer-container">
|
||||
<Footer></Footer>
|
||||
</footer> -->
|
||||
<RightButton class="absolute right-0 bottom-1/2" />
|
||||
<CustomModal ref="tipDialog" :title="t('dialog.titleTip')" :desc="tipDesc" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user