mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-10 11:57:35 +08:00
feat(ui): 重构 SearchBar、集成 useScrollTitle 标题滚动显示、修复专辑搜索跳转
- 重新设计 SearchBar:左侧 Tab(播放列表/MV/排行榜)+ 滑动指示器 + 搜索框自动展开收缩 - 新增 navTitle store 和 useScrollTitle hook,支持页面滚动后在 SearchBar 显示标题 - 集成 useScrollTitle 到 MusicListPage、歌手详情、关注/粉丝列表、搜索结果页 - 修复搜索结果页专辑点击跳转失败(缺失 type 字段) - 新增 5 种语言 searchBar tab i18n 键值
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
<!-- Header Section -->
|
||||
<section class="page-padding-x pt-6 md:pt-8 pb-4">
|
||||
<h1
|
||||
ref="titleElRef"
|
||||
class="text-2xl md:text-3xl font-bold text-neutral-900 dark:text-white tracking-tight"
|
||||
>
|
||||
<template v-if="targetUserName">
|
||||
@@ -134,6 +135,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { getUserFollowers } from '@/api/user';
|
||||
import PlayBottom from '@/components/common/PlayBottom.vue';
|
||||
import { useScrollTitle } from '@/hooks/useScrollTitle';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import type { IUserFollow } from '@/types/user';
|
||||
import { getImgUrl } from '@/utils';
|
||||
@@ -160,6 +162,14 @@ const targetUserName = ref<string>('');
|
||||
|
||||
const user = computed(() => userStore.user);
|
||||
|
||||
const titleElRef = ref<HTMLElement | null>(null);
|
||||
const followersTitle = computed(() =>
|
||||
targetUserName.value
|
||||
? targetUserName.value + t('user.follower.userFollowersTitle')
|
||||
: t('user.follower.myFollowersTitle')
|
||||
);
|
||||
useScrollTitle(followersTitle, titleElRef);
|
||||
|
||||
const checkTargetUser = () => {
|
||||
const uid = route.query.uid;
|
||||
const name = route.query.name;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<!-- Header Section -->
|
||||
<section class="page-padding-x pt-6 md:pt-8 pb-4">
|
||||
<h1
|
||||
ref="titleElRef"
|
||||
class="text-2xl md:text-3xl font-bold text-neutral-900 dark:text-white tracking-tight"
|
||||
>
|
||||
<template v-if="targetUserName">
|
||||
@@ -134,6 +135,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { getUserFollows } from '@/api/user';
|
||||
import PlayBottom from '@/components/common/PlayBottom.vue';
|
||||
import { useScrollTitle } from '@/hooks/useScrollTitle';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import type { IUserFollow } from '@/types/user';
|
||||
import { getImgUrl } from '@/utils';
|
||||
@@ -160,6 +162,14 @@ const targetUserName = ref<string>('');
|
||||
|
||||
const user = computed(() => userStore.user);
|
||||
|
||||
const titleElRef = ref<HTMLElement | null>(null);
|
||||
const followsTitle = computed(() =>
|
||||
targetUserName.value
|
||||
? targetUserName.value + t('user.follow.userFollowsTitle')
|
||||
: t('user.follow.myFollowsTitle')
|
||||
);
|
||||
useScrollTitle(followsTitle, titleElRef);
|
||||
|
||||
// 检查是否有指定用户ID
|
||||
const checkTargetUser = () => {
|
||||
const uid = route.query.uid;
|
||||
|
||||
Reference in New Issue
Block a user