Files
vscode-workbench/.trae/documents/remove-mobileguard-from-history.md
T

38 lines
1.2 KiB
Markdown

# 移除 /history 页面的 MobileGuard 包装
## 问题描述
访问 `/history` 页面时,如果用户未登录,MobileGuard 组件会强制显示登录提示弹窗,影响用户体验。历史页面是只读展示页面,不需要强制登录即可访问。
## 当前状态
- **文件**: [App.tsx](file:///c:/Users/12914/Desktop/vscode/chunyu_project_react/src/App.tsx#L127)
- **代码**: `<Route path="/history" element={<MobileGuard><History /></MobileGuard>} />`
- **问题**: MobileGuard 会在未登录时弹出登录提示弹窗
## 修改方案
### 修改文件
| 文件 | 修改内容 |
|------|----------|
| `src/App.tsx` | 移除 `/history` 路由的 MobileGuard 包装 |
### 具体改动
将:
```tsx
<Route path="/history" element={<MobileGuard><History /></MobileGuard>} />
```
改为:
```tsx
<Route path="/history" element={<History />} />
```
## 影响范围
- `/history` 页面不再被 MobileGuard 包装
- 未登录用户可以直接访问历史页面(显示空状态)
- 已登录用户功能不受影响
## 验证步骤
1. 未登录状态下访问 `/history`,不应弹出登录提示弹窗
2. 已登录状态下访问 `/history`,功能正常显示浏览记录
3. 其他使用 MobileGuard 的页面不受影响