navmini/weapp/README.md
eric 518410edd0 feat: 游民导航 H5、微信小程序与小红书小工具
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-27 12:15:00 -05:00

48 lines
1.6 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.

# 游民导航 · 微信小程序
原生微信小程序,数据与图标同步自仓库 H5:`src/data/links.json`、`public/icons/`。
交互对齐 H5:左侧抽屉跳转分类、整页长列表、浅/深色主题、回到顶部。因小程序无法直接打开任意外链,点击入口会弹出底部面板,**一键复制网址**后到浏览器粘贴打开(微信允许 `wx.setClipboardData`)。
结构参考 [nomadmini/miniapp](../../nomadmini/miniapp) 的 DevTools 接入方式(`project.config.json` + 开发者工具打开目录);实现上用原生小程序而非 Taro,更适合静态导航包。
## 本地预览
1. 同步数据与图标:
```bash
npm run weapp:sync
```
或在 `weapp/` 下:
```powershell
python scripts/sync_data.py
```
2. 打开 **微信开发者工具** → 导入项目 → 目录选本仓库的 **`weapp/`**(不要选上级)。
3. AppID:可用测试号,或把 `project.config.json` 里的 `touristappid` 换成你的小程序 AppID。
4. 详情 → 本地设置 → **不校验合法域名**(开发期)。
## 目录
```
weapp/
├── app.js / app.json / app.wxss
├── project.config.json
├── data/links.json # sync 生成,勿手改
├── icons/ # sync 生成
├── pages/index/ # 唯一页面
└── scripts/sync_data.py
```
## 与 H5 / 小红书差异
| | H5 | 微信 weapp | 小红书 xhs |
|--|----|-----------|------------|
| 打开链接 | `window.open` | 复制到剪贴板 | 手动长按复制 |
| 数据 | `src/data/links.json` | sync → `data/` + `icons/` | sync → zip |
| 运行 | Vite | 微信开发者工具 | 创作平台上传 zip |