📚 API 参考
本节介绍 GlassMusicPlayer 的核心 API 模块。
📖 目录
- 🪝 Composables 组合式函数 - useAudio、useLyrics 等
- 🗄️ Store 状态管理 - Pinia 状态模块
- 🌐 HTTP API - 网易云音乐 API 封装
📝 代码风格
- 📘 所有 API 使用 TypeScript 编写
- 🪝 组合式函数使用
useXxx命名 - 🗄️ Store 模块使用
useXxxStore命名 - 📂 HTTP 请求函数按功能分组
🔍 快速索引
🪝 Composables
| 函数 | 说明 |
|---|---|
🎧 useAudio() | 音频播放控制 |
📝 useLyrics() | 歌词解析与同步 |
⌨️ useGlobalKeyboard() | 全局键盘快捷键 |
🗄️ Stores
| Store | 说明 |
|---|---|
🎧 useAudioStore | 播放器状态 |
🌐 useGlobalStore | 全局状态(主题、语言、搜索历史) |
⚙️ useSettingsStore | 设置状态(背景、歌词) |
👤 useUserStore | 用户登录状态 |
🌐 HTTP API
| 分类 | 示例函数 |
|---|---|
| 🔐 登录 | loginCellphone, qrLoginKey, loginStatus |
| 🔍 搜索 | search, cloudSearch, searchSuggest |
| 🎵 歌曲 | songDetail, songUrl, lyric |
| 📋 歌单 | playlistDetail, playlistTrackAll |
| 🎤 艺术家 | artistDetail, artistTopSong, artistAlbum |
| 💿 专辑 | albumDetail, albumNew |
| 🎬 MV | mvDetail, mvUrl, mvAll |
| 📊 排行榜 | toplist, topSong |
| ✨ 推荐 | personalized, recommendSongs |
| 💬 评论 | commentMusic, commentNew |