修复 z-index 层级问题
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
border-bottom-left-radius: 30px;
|
||||
border-bottom-right-radius: 30px;
|
||||
background-color: #fafafa !important;
|
||||
z-index: 1000 !important;
|
||||
z-index: 1100 !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import { Menu } from "@nutui/nutui-react-taro";
|
||||
import { Image, View } from "@tarojs/components";
|
||||
import img from "@/config/images";
|
||||
@@ -14,10 +14,12 @@ const DistanceQuickFilter = (props) => {
|
||||
quickName,
|
||||
cityValue,
|
||||
quickValue,
|
||||
onMenuVisibleChange, // 新增:菜单展开/收起回调
|
||||
} = props;
|
||||
const cityRef = useRef(null);
|
||||
const quickRef = useRef(null);
|
||||
const [changePosition, setChangePosition] = useState<number[]>([]);
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
// 全城筛选显示的标题
|
||||
const cityTitle = cityOptions.find((item) => item.value === cityValue)?.label;
|
||||
@@ -48,10 +50,17 @@ const DistanceQuickFilter = (props) => {
|
||||
index === 1 && (quickRef.current as any)?.toggle(false);
|
||||
};
|
||||
|
||||
// 监听菜单状态变化,通知父组件
|
||||
useEffect(() => {
|
||||
onMenuVisibleChange?.(isMenuOpen);
|
||||
}, [isMenuOpen, onMenuVisibleChange]);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Menu
|
||||
className={`distanceQuickFilterWrap ${filterWrapperClassName}`}
|
||||
onOpen={() => setIsMenuOpen(true)}
|
||||
onClose={() => setIsMenuOpen(false)}
|
||||
>
|
||||
<Menu.Item
|
||||
title={cityTitle}
|
||||
|
||||
@@ -111,7 +111,7 @@ const FilterPopup = (props: FilterPopupProps) => {
|
||||
onClose={onClose}
|
||||
style={{ marginTop: statusNavbarHeigh + "px", maxHeight: '70vh' }}
|
||||
overlayStyle={{ marginTop: statusNavbarHeigh + "px" }}
|
||||
zIndex={1001}
|
||||
zIndex={1200}
|
||||
>
|
||||
<View className={styles.filterPopupWrapper}>
|
||||
{/* 可滚动的内容区域 */}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 12px 32px;
|
||||
z-index: 999;
|
||||
z-index: 900;
|
||||
|
||||
&-pages {
|
||||
display: flex;
|
||||
|
||||
@@ -7,7 +7,7 @@ import PublishMenu from "../PublishMenu";
|
||||
export type currentPageType = "games" | "message" | "personal";
|
||||
|
||||
const GuideBar = (props) => {
|
||||
const { currentPage, guideBarClassName } = props;
|
||||
const { currentPage, guideBarClassName, onPublishMenuVisibleChange } = props;
|
||||
|
||||
const guideItems = [
|
||||
{
|
||||
@@ -73,7 +73,7 @@ const GuideBar = (props) => {
|
||||
{/* <View className='guide-bar-publish' onClick={handlePublish}>
|
||||
<Image className='guide-bar-publish-icon' src={img.ICON_GUIDE_BAR_PUBLISH} />
|
||||
</View> */}
|
||||
<PublishMenu />
|
||||
<PublishMenu onVisibleChange={onPublishMenuVisibleChange} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useRef } from "react";
|
||||
import React, { useState, useRef, useEffect } from "react";
|
||||
import { View, Text, Image } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { useUserInfo } from "@/store/userStore";
|
||||
@@ -15,10 +15,17 @@ import NTRPEvaluatePopup from "../NTRPEvaluatePopup";
|
||||
export interface PublishMenuProps {
|
||||
onPersonalPublish?: () => void;
|
||||
onActivityPublish?: () => void;
|
||||
onVisibleChange?: (visible: boolean) => void; // 菜单显示/隐藏回调
|
||||
}
|
||||
|
||||
const PublishMenu: React.FC<PublishMenuProps> = () => {
|
||||
const PublishMenu: React.FC<PublishMenuProps> = (props) => {
|
||||
const { onVisibleChange } = props;
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
// 使用 useEffect 监听 isVisible 变化,确保所有情况都能触发回调
|
||||
useEffect(() => {
|
||||
onVisibleChange?.(isVisible);
|
||||
}, [isVisible, onVisibleChange]);
|
||||
const [aiImportVisible, setAiImportVisible] = useState(false);
|
||||
const userInfo = useUserInfo();
|
||||
const ntrpRef = useRef<{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.publishMenu {
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
z-index: 950;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
@@ -10,7 +10,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 999;
|
||||
z-index: 940;
|
||||
}
|
||||
.menuCard {
|
||||
position: absolute;
|
||||
@@ -22,7 +22,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
z-index: 1001;
|
||||
z-index: 960;
|
||||
// /* 小三角指示器 */
|
||||
// &::after {
|
||||
// content: '';
|
||||
|
||||
Reference in New Issue
Block a user