uni-app
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseThe skill is based on uni-app documentation, generated at 2026-01-30.
uni-app is a Vue.js-based cross-platform framework for developing applications that run on iOS, Android, HarmonyOS, Web (responsive), and various mini-program platforms (WeChat/Alipay/Baidu/Douyin/Feishu/QQ/Kuaishou/DingTalk/Taobao/Jingdong/Xiaohongshu).
本技能基于uni-app文档生成,生成时间为2026年1月30日。
uni-app是一个基于Vue.js的跨平台开发框架,可用于开发在iOS、Android、HarmonyOS、Web(响应式)以及各类小程序平台(微信/支付宝/百度/抖音/飞书/QQ/快手/钉钉/淘宝/京东/小红书)运行的应用。
Core
核心部分
| Topic | Description | Reference |
|---|---|---|
| Core Framework | Project structure, platform support, condition compilation | core-framework |
| View Components | view, scroll-view, swiper, movable-area, cover-view | core-view-components |
| Form Components | input, textarea, picker, checkbox, radio, switch, slider | core-form-components |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 核心框架 | 项目结构、平台支持、条件编译 | core-framework |
| 视图组件 | view、scroll-view、swiper、movable-area、cover-view | core-view-components |
| 表单组件 | input、textarea、picker、checkbox、radio、switch、slider | core-form-components |
Features
功能特性
UI Components
UI组件
| Topic | Description | Reference |
|---|---|---|
| Media Components | image, video, camera, live-player, map | feature-media-components |
| Navigation | navigator, routing, page navigation | feature-navigation |
| UI Feedback | toast, modal, loading, action sheet, pull refresh | feature-ui-feedback |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 媒体组件 | image、video、camera、live-player、map | feature-media-components |
| 导航 | navigator、路由、页面导航 | feature-navigation |
| UI反馈 | toast、modal、loading、操作表、下拉刷新 | feature-ui-feedback |
APIs
APIs
| Topic | Description | Reference |
|---|---|---|
| Network | HTTP requests, file upload/download, WebSocket | feature-network |
| Storage | Local storage, file system, caching | feature-storage |
| System Info | Device info, network status, screen, vibration | feature-system-info |
| File Operations | Image/video selection, file system operations | feature-file-operations |
| Location | Geolocation, map component, address selection | feature-location |
| Lifecycle | App and page lifecycle hooks | feature-lifecycle |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| 网络 | HTTP请求、文件上传/下载、WebSocket | feature-network |
| 存储 | 本地存储、文件系统、缓存 | feature-storage |
| 系统信息 | 设备信息、网络状态、屏幕、震动 | feature-system-info |
| 文件操作 | 图片/视频选择、文件系统操作 | feature-file-operations |
| 定位 | 地理定位、地图组件、地址选择 | feature-location |
| 生命周期 | 应用和页面生命周期钩子 | feature-lifecycle |
Configuration
配置
| Topic | Description | Reference |
|---|---|---|
| pages.json | Page routing, tab bar, global styles, sub-packages | config-pages |
| manifest.json | App config, permissions, platform settings | config-manifest |
| 主题 | 描述 | 参考文档 |
|---|---|---|
| pages.json | 页面路由、标签栏、全局样式、分包 | config-pages |
| manifest.json | 应用配置、权限、平台设置 | config-manifest |
Platform Support
平台支持
| Platform | Support Level |
|---|---|
| iOS App | Full support |
| Android App | Full support |
| HarmonyOS Next | Full support |
| H5/Web | Full support |
| WeChat Mini Program | Full support |
| Alipay Mini Program | Full support |
| Baidu Smart Program | Full support |
| Douyin Mini Program | Full support |
| QQ Mini Program | Full support |
| Kuaishou Mini Program | Full support |
| Feishu Mini Program | Full support |
| JD Mini Program | Full support |
| HarmonyOS Meta Service | Full support |
| 平台 | 支持等级 |
|---|---|
| iOS App | 完全支持 |
| Android App | 完全支持 |
| HarmonyOS Next | 完全支持 |
| H5/Web | 完全支持 |
| 微信小程序 | 完全支持 |
| 支付宝小程序 | 完全支持 |
| 百度智能小程序 | 完全支持 |
| 抖音小程序 | 完全支持 |
| QQ小程序 | 完全支持 |
| 快手小程序 | 完全支持 |
| 飞书小程序 | 完全支持 |
| 京东小程序 | 完全支持 |
| HarmonyOS元服务 | 完全支持 |
Key Concepts
关键概念
Condition Compilation
条件编译
Use special comments to write platform-specific code:
vue
<!-- #ifdef APP-PLUS -->
<view>App only</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view>WeChat only</view>
<!-- #endif -->使用特殊注释编写平台专属代码:
vue
<!-- #ifdef APP-PLUS -->
<view>App only</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view>WeChat only</view>
<!-- #endif -->API Promise Support
API Promise支持
Most uni-app APIs support Promise when no callback is provided:
javascript
const res = await uni.request({ url: 'https://api.example.com' })当不提供回调函数时,大多数uni-app API支持Promise:
javascript
const res = await uni.request({ url: 'https://api.example.com' })Cross-Platform Best Practices
跨平台最佳实践
- Use uni-app components and APIs instead of platform-specific ones
- Use condition compilation for platform-specific features
- Test on all target platforms
- Use rpx for responsive layouts
- Handle platform differences in manifest.json
- must use uni-helper tools
- 使用uni-app组件和API,而非平台专属组件和API
- 针对平台专属特性使用条件编译
- 在所有目标平台进行测试
- 使用rpx实现响应式布局
- 在manifest.json中处理平台差异
- 必须使用uni-helper工具
MCP扩展
MCP扩展
当需要查询 uni-app 官方文档时,优先调用 MCP 工具搜索相关 API 文档和使用示例。
search-docs-by-Uniapp-official使用场景:
- 用户询问特定 API 的详细用法
- 需要官方文档中的代码示例
- 查询组件的属性和事件
- 了解 API 的平台兼容性
工具安装:
如果检测到该 MCP 工具不可用,引导用户访问 https://github.com/uni-helper/mcp 进行安装。
当需要查询uni-app官方文档时,优先调用 MCP 工具搜索相关 API 文档和使用示例。
search-docs-by-Uniapp-official使用场景:
- 用户询问特定 API 的详细用法
- 需要官方文档中的代码示例
- 查询组件的属性和事件
- 了解 API 的平台兼容性
工具安装:
如果检测到该 MCP 工具不可用,引导用户访问 https://github.com/uni-helper/mcp 进行安装。