Files
x-server-mobile/dev/已知问题和解决方案.md
T
root 2d39357cc3 feat: 实现出差申请页面
- 创建出差申请表单,包含出差事由、行程明细、审批人选择
- 实现行程明细的增删改功能,支持开始/结束时间、出发地、目的地等
- 添加单程/往返类型选择和交通工具下拉选择
- 实现自动计算行程时长和总时长
- 创建审批人和抄送人选择页面
- 添加前后端API接口定义
- 更新i18n国际化翻译
- 整理开发文档和UI设计图

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 23:44:40 +08:00

56 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 前端开发已知问题和解决方案
## 1. antd-mobile-icons 导入错误
**问题**: `The requested module '/node_modules/.vite/deps/antd-mobile-icons.js' does not provide an export named 'PlusOutline'`
**原因**: antd-mobile-icons 中没有 `PlusOutline` 图标
**解决方案**: 使用正确的图标名称:
- `PlusOutline` → `AddOutline`
- 可通过查看 `node_modules/antd-mobile-icons/es/index.d.ts` 确认可用的图标
## 2. DatePicker 组件报错
**问题**: `Cannot read properties of null (reading 'getTime')`
**原因**: DatePicker 组件的 `min` 或 `max` 属性接收到了 `null` 值
**解决方案**: 使用条件展开运算符,只在值存在时传递属性:
```tsx
// 错误写法
<DatePicker min={startDate || undefined} />
// 正确写法
<DatePicker {...(startDate && { min: startDate })} />
```
## 3. 端口占用问题
**问题**: Vite 启动时端口被占用,自动尝试其他端口
**解决方案**: 清理旧进程后重启
```bash
ps aux | grep vite | grep -v grep | awk '{print $2}' | xargs -r kill -9
```
## 4. 防火墙规则
**问题**: 外网无法访问开发服务器
**解决方案**: 添加防火墙规则
```bash
iptables -I INPUT -p tcp --dport 5173 -j ACCEPT
```
## 5. Vite 配置
确保 `vite.config.ts` 中配置正确的 host:
```ts
server: {
port: 5173,
host: '0.0.0.0', // 允许外网访问
proxy: { ... }
}
```