fix: price page back button display (#6060)

This commit is contained in:
heheer
2025-12-09 12:18:59 +08:00
committed by GitHub
parent bdee2db74a
commit d354fd4d67

View File

@@ -21,7 +21,7 @@ const PriceBox = () => {
const router = useRouter();
const backButtonRef = useRef<HTMLButtonElement>(null);
const [isButtonInView, setIsButtonInView] = useState(true);
const [isButtonInView, setIsButtonInView] = useState(false);
const { data: teamSubPlan } = useRequest2(getTeamPlanStatus, {
manual: false,
@@ -30,6 +30,11 @@ const PriceBox = () => {
// TODO: 封装成一个 hook 来判断滚动态
useEffect(() => {
if (!teamSubPlan?.standard?.teamId) {
setIsButtonInView(false);
return;
}
const observer = new IntersectionObserver(
([entry]) => {
setIsButtonInView(entry.isIntersecting);
@@ -50,7 +55,7 @@ const PriceBox = () => {
}
observer.disconnect();
};
}, []);
}, [teamSubPlan?.standard?.teamId]);
const onPaySuccess = () => {
setTimeout(() => {