mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-18 20:14:41 +08:00
fix: douban selector reselect
This commit is contained in:
@@ -226,16 +226,25 @@ function DoubanPageClient() {
|
|||||||
// 处理选择器变化
|
// 处理选择器变化
|
||||||
const handlePrimaryChange = useCallback(
|
const handlePrimaryChange = useCallback(
|
||||||
(value: string) => {
|
(value: string) => {
|
||||||
setLoading(true);
|
// 只有当值真正改变时才设置loading状态
|
||||||
setPrimarySelection(value);
|
if (value !== primarySelection) {
|
||||||
|
setLoading(true);
|
||||||
|
setPrimarySelection(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[type]
|
[primarySelection]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSecondaryChange = useCallback((value: string) => {
|
const handleSecondaryChange = useCallback(
|
||||||
setLoading(true);
|
(value: string) => {
|
||||||
setSecondarySelection(value);
|
// 只有当值真正改变时才设置loading状态
|
||||||
}, []);
|
if (value !== secondarySelection) {
|
||||||
|
setLoading(true);
|
||||||
|
setSecondarySelection(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[secondarySelection]
|
||||||
|
);
|
||||||
|
|
||||||
const getPageTitle = () => {
|
const getPageTitle = () => {
|
||||||
// 根据 type 生成标题
|
// 根据 type 生成标题
|
||||||
|
|||||||
@@ -241,8 +241,8 @@ const DoubanSelector: React.FC<DoubanSelectorProps> = ({
|
|||||||
onClick={() => onChange(option.value)}
|
onClick={() => onChange(option.value)}
|
||||||
className={`relative z-10 px-2 py-1 sm:px-4 sm:py-2 text-xs sm:text-sm font-medium rounded-full transition-all duration-200 whitespace-nowrap ${
|
className={`relative z-10 px-2 py-1 sm:px-4 sm:py-2 text-xs sm:text-sm font-medium rounded-full transition-all duration-200 whitespace-nowrap ${
|
||||||
isActive
|
isActive
|
||||||
? 'text-gray-900 dark:text-gray-100'
|
? 'text-gray-900 dark:text-gray-100 cursor-default'
|
||||||
: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100'
|
: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 cursor-pointer'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{option.label}
|
{option.label}
|
||||||
|
|||||||
Reference in New Issue
Block a user