feat(導航組件優化): 移除NavCommon組件中的冗餘onMenuClick屬性,並優化菜單圖標點擊邏輯以實現路由切換,提升用戶體驗。
This commit is contained in:
@@ -23,10 +23,7 @@ interface NavCommonProps {
|
||||
onMenuClick?: () => void;
|
||||
}
|
||||
|
||||
const NavCommon: React.FC<NavCommonProps> = ({
|
||||
title = "触客宝",
|
||||
onMenuClick,
|
||||
}) => {
|
||||
const NavCommon: React.FC<NavCommonProps> = ({ title = "触客宝" }) => {
|
||||
const [drawerVisible, setDrawerVisible] = useState(false);
|
||||
const [messageDrawerVisible, setMessageDrawerVisible] = useState(false);
|
||||
const [messageCount] = useState(3); // 模拟消息数量
|
||||
@@ -34,10 +31,14 @@ const NavCommon: React.FC<NavCommonProps> = ({
|
||||
const location = useLocation();
|
||||
const { user, logout } = useUserStore();
|
||||
|
||||
// 处理菜单图标点击
|
||||
// 处理菜单图标点击:在两个路由之间切换
|
||||
const handleMenuClick = () => {
|
||||
setDrawerVisible(true);
|
||||
onMenuClick?.();
|
||||
const current = location.pathname;
|
||||
if (current.startsWith("/pc/powerCenter")) {
|
||||
navigate("/pc/weChat");
|
||||
} else {
|
||||
navigate("/pc/powerCenter");
|
||||
}
|
||||
};
|
||||
|
||||
// 处理抽屉关闭
|
||||
|
||||
Reference in New Issue
Block a user