返回顶部
i

ionic-app-developmentIonic应用开发

Guides the agent through general Ionic Framework development including core concepts, component reference, CLI usage, layout, theming, animations, gestures, development workflow, and troubleshooting. Covers all Ionic UI components grouped by category with properties, events, methods, slots, and CSS custom properties. Do not use for creating a new Ionic app (use ionic-app-creation), framework-specific patterns (use ionic-angular, ionic-react, ionic-vue), or upgrading Ionic versions (use ionic-app

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
115
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

ionic-app-development

Ionic App Development

通用Ionic框架开发——核心概念、组件参考、CLI使用、布局、主题、工具、开发工作流及故障排除。

前置条件

  1. 1. 已安装 Node.js(最新LTS版本)。
  2. 全局安装 Ionic CLI(npm install -g @ionic/cli)。
  3. 存在一个Ionic项目。如需创建新Ionic应用,请使用 ionic-app-creation 技能。

代理行为

  • - 自动检测框架。 检查 package.json 中的 @ionic/angular、@ionic/react 或 @ionic/vue,以确定当前使用的框架,并相应调整代码示例。
  • 路由至参考文件。 本技能为概述性内容,将代理引导至特定参考文件,以获取详细的组件API和主题相关指导。
  • 不重复框架特定技能。 对于Angular、React或Vue的特定模式,请参考相应的框架技能。

核心概念

Ionic工作原理

Ionic Framework是一个UI工具包,用于使用Web技术(HTML、CSS、JavaScript/TypeScript)构建跨平台应用。它提供了一系列预构建的UI组件,这些组件会根据平台(ios 或 md 模式)自动调整样式。

  • - 组件 是以 ion- 为前缀的自定义HTML元素(Web组件),例如
  • 平台模式:Ionic根据平台以不同方式渲染组件。iOS设备使用 ios 模式;Android及其他所有平台使用 md(Material Design)模式。 元素会接收一个类名(ios 或 md),用于启用特定平台的样式。
  • Capacitor集成:Ionic应用使用Capacitor访问原生设备功能。Ionic负责UI,Capacitor负责原生API。Capacitor相关指导请参见 capacitor-app-development 技能。

页面生命周期

Ionic在框架自身的生命周期钩子之上提供了生命周期事件。这些事件在页面导航进入或离开时触发:

事件描述
ionViewWillEnter页面即将进入并变为活跃状态时触发。
ionViewDidEnter
页面已完全进入并处于活跃状态时触发。 |
| ionViewWillLeave | 页面即将离开并变为非活跃状态时触发。 |
| ionViewDidLeave | 页面已完全离开并处于非活跃状态时触发。 |

这些事件是框架特定生命周期钩子(例如Angular的 ngOnInit、React的 useEffect、Vue的 onMounted)的补充。对于每次页面变为可见时应执行的任务(例如刷新数据),请使用Ionic生命周期事件,因为某些导航策略会缓存页面。

组件参考

Ionic提供了80多个UI组件。每个组件的详细API文档按类别组织在参考文件中。每个参考文件涵盖了属性、事件、方法、插槽、CSS Shadow Parts和CSS自定义属性。

当用户需要特定组件的帮助时,请阅读相应的参考文件。

类别参考文件涵盖的组件
操作与按钮references/components-action.mdaction-sheet, button, fab, fab-button, fab-list, ripple-effect
数据展示
references/components-data-display.md | accordion, accordion-group, badge, card, card-content, card-header, card-subtitle, card-title, chip, item, item-divider, item-group, item-sliding, item-options, item-option, label, list, list-header, note, text |
| 表单 | references/components-form.md | checkbox, datetime, datetime-button, input, input-otp, input-password-toggle, picker, radio, radio-group, range, searchbar, select, select-option, segment, segment-button, segment-content, segment-view, textarea, toggle |
| 布局 | references/components-layout.md | app, content, grid, col, row, header, footer, toolbar, title, buttons, back-button, split-pane |
| 媒体 | references/components-media.md | avatar, icon, img, thumbnail |
| 导航 | references/components-navigation.md | breadcrumb, breadcrumbs, menu, menu-button, menu-toggle, nav, nav-link, router, router-link, router-outlet, route, route-redirect, tabs, tab, tab-bar, tab-button |
| 覆盖层 | references/components-overlay.md | alert, loading, modal, popover, toast, backdrop |
| 滚动与虚拟 | references/components-scroll.md | infinite-scroll, infinite-scroll-content, refresher, refresher-content, reorder, reorder-group |
| 进度 | references/components-progress.md | progress-bar, skeleton-text, spinner |

Ionic CLI

Ionic CLI是开发Ionic应用的主要工具。以下是常用命令。运行 ionic --help 获取完整且最新的命令列表。

安装

bash
npm install -g @ionic/cli

如果从旧版 ionic 包升级:

bash
npm uninstall -g ionic
npm install -g @ionic/cli

关键命令

命令描述
ionic serve启动本地开发服务器,支持热重载。
ionic serve --external
在所有网络接口上提供服务(用于在设备上测试)。 | | ionic serve --port= | 在自定义端口上提供服务(默认:8100)。 | | ionic serve --prod | 使用生产构建配置提供服务。 | | ionic build | 构建生产环境的Web应用。 | | ionic generate | 生成页面、组件、服务(依赖于框架)。 | | ionic doctor check | 检查项目是否存在常见问题。 | | ionic info | 打印系统/环境信息,用于错误报告。 | | ionic repair | 移除并重新创建依赖项和平台文件。 |

ionic serve 选项

选项描述
--ssl启用HTTPS(实验性功能)。
--no-livereload
提供服务但不自动重新加载。 | | --no-open | 不自动打开浏览器窗口。 | | --consolelogs | 在终端中打印应用控制台输出。 | | --browser= | 在特定浏览器中打开(safari, firefox, google chrome)。 | | --browseroption= | 打开特定的URL路径(例如 /#/tab/dash)。 |

如需传递框架特定的CLI选项,请在 -- 后添加:

bash
ionic serve -- --proxy-config proxy.conf.json

布局

请阅读 references/components-layout.md 获取布局组件的完整API参考。

网格系统

Ionic使用12列flexbox网格系统(ion-grid、ion-row、ion-col)。除非指定了 size 属性(1-12),否则列将均匀扩展以填满行。

响应式断点:

断点最小宽度CSS类前缀
xs0(默认)
sm
576px | sizeSm |
| md | 768px | sizeMd |
| lg | 992px | sizeLg |
| xl | 1200px | sizeXl |

CSS工具类

Ionic为常见样式需求提供了响应式CSS工具类:

  • - 文本:.ion-text-center、.ion-text-start、.ion-text-end、.ion-text-wrap、.ion-text-nowrap、.ion-text-uppercase、.ion-text-lowercase、.ion-text-capitalize
  • 内边距:.ion-padding、.ion-padding-top、.ion-padding-bottom、.ion-padding-start、.ion-padding-end、.ion-padding-vertical、.ion-padding-horizontal、.ion-no-padding
  • 外边距:.ion-margin、.ion-margin-top、.ion-margin-bottom、.ion-margin-start、.ion-margin-end、.ion-margin-vertical、.ion-margin-horizontal、.ion-no-margin
  • 显示:.ion-display-none、.ion-display-block、.ion-display-flex、.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ionic-app-development-1776030662 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ionic-app-development-1776030662 技能

通过命令行安装

skillhub install ionic-app-development-1776030662

下载

⬇ 下载 ionic-app-development v1.0.0(免费)

文件大小: 28.61 KB | 发布时间: 2026-4-13 10:41

v1.0.0 最新 2026-4-13 10:41
Initial release of the Ionic App Development skill.

- Provides guidance on core Ionic concepts, component references, CLI usage, theming, layout, animations, and troubleshooting.
- Includes a complete component categorization with reference file routing for detailed API documentation.
- Covers best practices for development workflow and integration with Capacitor.
- Explicitly directs users to framework- or version-specific skills when needed.
- Outlines recommended agent behavior for framework detection and information routing.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部