关于 uniapp-project
面向 uni-app 开发的技能,将组件和 API 示例与详细参考资料分类整理,帮助开发者查询平台兼容性,并按文档模式构建跨平台应用。
主要功能
- 01内置组件与 uni-ui 示例
- 02按领域分类的 API 示例
- 03参数与兼容性详细参考
- 04官方文档链接
- 05平台差异处理指南
适用场景
- 01查找组件用法示例
- 02查询 API 参数和返回值
- 03确认目标平台的支持情况
- 04用条件编译处理平台差异
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ partme-ai/ full-stack-skills --skill uniapp-project安装后在 Claude Code 中输入/uniapp-project确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
CHECKLIST.mdLICENSE.txtUPDATE_PLAN.mdexamples/api/device/get-battery-info.mdget-network-type.mdget-screen-brightness.mdget-system-info.mdset-screen-brightness.mdexamples/api/file/get-file-info.mdget-saved-file-list.mdsave-file.mdexamples/api/location/choose-location.mdget-location.mdopen-location.mdexamples/api/media/choose-image.mdchoose-media.mdchoose-video.mdget-image-info.mdpreview-image.mdsave-image-to-photos-album.mdexamples/api/navigation/navigate-back.mdnavigate-to.mdre-launch.mdredirect-to.mdswitch-tab.mdexamples/api/network/download-file.mdrequest.mdupload-file.mdexamples/api/storage/clear-storage.mdget-storage-info.md详细介绍
适用场景
在用户希望进行以下操作时,使用此技能:
- 使用任何 uni-app 内置组件或 uni-ui 组件
- 使用任何 uni-app API(网络、存储、设备、界面、导航、媒体等)
- 通过官方文档链接查看各组件或 API 的示例
- 检查组件和 API 的平台兼容性
- 按照官方模式构建跨平台 uni-app 应用
使用方法
此技能的组织方式与 uni-app 官方组件和 API 文档对应:
-
选择组件或 API 类别:
- 组件 →
examples/components/built-in/和examples/uni-ui/ - API →
examples/api/(按领域分类)
- 组件 →
-
打开相应的示例文件:
- 每个组件或 API 都有专属的示例文件
- 每个示例都包含官方文档 URL
- 示例与官方文档中的示例保持一致
-
需要完整规范时查阅参考资料:
- 内置组件:
references/components/built-in/ - uni-ui 组件:
references/components/uni-ui/ - API 参数、返回值和兼容性详情:
references/api/
- 内置组件:
示例和参考资料
组件(内置)
- 示例:
examples/components/built-in/*.md - 参考资料:
references/components/built-in/*.md - 官方文档:https://uniapp.dcloud.net.cn/component/
组件(uni-ui)
- 示例:
examples/uni-ui/*.vue和examples/uni-ui/README.md - 参考资料:
references/components/uni-ui/*.md - 官方文档:https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html
- 插件:https://ext.dcloud.net.cn/plugin?id=55
API
- 示例:
examples/api/{category}/*.md - 参考资料:
references/api/*.md - 官方文档:https://uniapp.dcloud.net.cn/api/
最佳实践
- 每个组件或 API 使用一个文件:每个组件和 API 都有独立的示例文件,并附有官方文档链接。
- 遵循平台兼容性要求:查看每个示例或参考资料中的兼容性部分。
- 使用条件编译:使用
#ifdef/#endif编写平台专属逻辑。 - 确保示例与文档一致:以官方文档中的示例为准。
- 查看完整规范时优先使用参考资料:使用
references/查看完整参数表和兼容性信息。
资源
- 组件:https://uniapp.dcloud.net.cn/component/
- API:https://uniapp.dcloud.net.cn/api/
- uni-ui:https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html
- 插件市场:https://ext.dcloud.net.cn/
关键词
uniapp、uni-app、组件、api、内置组件、uni-ui、示例、参考资料、pages.json、manifest.json、H5、App、小程序、跨平台、组件、API、官方文档
examples/api/network/- 网络请求 API 示例examples/api/storage/- 数据存储 API 示例examples/api/device/- 设备信息 API 示例examples/api/ui/- 界面交互 API 示例examples/api/location/- 位置服务 API 示例examples/api/media/- 媒体处理 API 示例examples/api/navigation/- 页面路由 API 示例examples/api/file/- 文件操作 API 示例examples/api/payment/- 支付 API 示例examples/api/share/- 分享 API 示例examples/api/other/- 其他 API 示例examples/uni-ui/- uni-ui 组件的完整示例代码(每个组件一个独立的 .vue 文件)
使用场景:需要查看组件或 API 的完整使用示例时,可参考此目录下的示例文件。每个示例文件都包含官网展示的所有示例场景,可直接复制使用。
注意:
- references/ 和 examples/ 的职责不同,不应合并。references/ 提供文档说明,examples/ 提供可运行代码。
- 每个组件和 API 都有独立的示例文件,包含原文档地址和官网中的全部示例
- 内置组件的示例代码位于
examples/components/built-in/目录 - API 的示例代码位于
examples/api/目录,并按类别组织 - uni-ui 组件的完整示例代码位于
examples/uni-ui/目录
平台支持
uni-app 支持以下平台:
- H5:Web 浏览器
- 微信小程序:WeChat Mini Program
- 支付宝小程序:Alipay Mini Program
- 百度小程序:Baidu Smart Program
- 字节跳动小程序:ByteDance Mini Program
- QQ 小程序:QQ Mini Program
- 快手小程序:Kuaishou Mini Program
- App:iOS、Android(nvue、vue)
- 快应用:Quick App
各组件和 API 的详细平台支持情况,请参阅对应文档。
参考资源
- 官方文档:https://uniapp.dcloud.net.cn/
- 组件文档:https://uniapp.dcloud.net.cn/component/
- API 文档:https://uniapp.dcloud.net.cn/api/
- 插件市场:https://ext.dcloud.net.cn/
- 社区问答:https://ask.dcloud.net.cn/
使用示例
组件使用示例
基础组件使用示例:
<template>
<view class="container">
<text>{{ message }}</text>
<button @click="handleClick">点击按钮</button>
<image :src="imageUrl" mode="aspectFit"></image>
</view>
</template>
<script>
export default {
data() {
return {
message: 'Hello UniApp',
imageUrl: '/static/logo.png'
}
},
methods: {
handleClick() {
uni.showToast({
title: '按钮被点击',
icon: 'success'
})
}
}
}
</script>
更多组件示例:
- 内置组件示例:请参考官方文档或
references/components/built-in/目录下的组件文档 - uni-ui 组件完整示例:见
examples/uni-ui/目录(每个组件都有独立的 .vue 示例文件) - 组件详细文档:见
references/components/built-in/和references/components/uni-ui/目录(每个组件都有独立的文档文件,包含属性、事件、平台兼容性、使用示例)
API 使用示例
// 网络请求
uni.request({
url: 'https://api.example.com/data',
method: 'GET',
success: (res) => {
console.log(res.data)
},
fail: (err) => {
console.error(err)
}
})
// 数据存储
uni.setStorage({
key: 'userInfo',
data: { name: 'John', age: 30 },
success: () => {
console.log('存储成功')
}
})
// 页面跳转
uni.navigateTo({
url: '/pages/detail/detail?id=123'
})
更多 API 示例:见 references/api/ 目录中的详细文档
注意事项
- 组件层级:原生组件(如 video、map)层级高于普通组件,需要使用 cover-view 覆盖
- 条件编译:使用
#ifdef、#endif处理平台差异 - 生命周期:注意 uni-app 的页面生命周期和组件生命周期
- 样式单位:推荐使用 rpx 作为响应式单位
- 性能优化:合理使用组件,避免过度嵌套,注意长列表优化
评论
支持 Markdown