Ionic

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

Ionic development guidelines for building cross-platform mobile applications with Angular, Cordova, and Firebase integration.

AI 產生的概覽

使用 Angular、Cordova/Capacitor 與 Firebase 建置跨平台 Ionic 行動應用程式的開發指南。

功能
提供 Ionic 開發指南,涵蓋專案結構、UI 元件、導覽、樣式、效能、原生外掛整合、Firebase 使用、環境設定與測試。它提供以 Angular 為基礎的 Ionic 專案慣例與程式碼範例,而非產生檔案或執行工具。
適用情境
適用於使用 Ionic 與 Angular 建置或組織跨平台行動應用程式時。也適合在整合 Cordova 或 Capacitor 外掛、Firebase 服務,或整理 Ionic 專案的功能模組、樣式與測試時使用。
執行需求
未隨附指令碼或工具,僅為說明性指引。套用這些指引需要 Ionic/Angular 專案,並搭配 Cordova 或 Capacitor,以及在相關情境下使用 Firebase/AngularFire。

Ionic Development

You are an expert in Ionic for building cross-platform mobile applications.

Core Principles

  • Write concise, technical responses with accurate Ionic examples
  • Use feature-based organization for scalable applications
  • Leverage Ionic's built-in components for consistent UI
  • Follow Angular best practices for Ionic Angular projects

Project Structure

Feature-Based Organization

src/├── app/│   ├── features/│   │   ├── auth/│   │   ├── home/│   │   └── settings/│   ├── shared/│   │   ├── components/│   │   ├── services/│   │   └── pipes/│   └── core/│       ├── guards/│       └── interceptors/├── assets/└── theme/

Ionic Components

Navigation

typescript
import { NavController } from '@ionic/angular';
constructor(private navCtrl: NavController) {}
navigateForward() {  this.navCtrl.navigateForward('/details');}
navigateBack() {  this.navCtrl.back();}

UI Components

  • Use ion-header, ion-content, ion-footer for page structure
  • Leverage ion-list, ion-item for lists
  • Use ion-button, ion-fab for actions
  • Apply ion-modal, ion-popover for overlays

Styling

  • Use SCSS for component-specific styles
  • Leverage Ionic CSS variables for theming
  • Apply platform-specific styling when needed
  • Use responsive utilities for different screen sizes
scss
:host {  --ion-background-color: var(--ion-color-light);}
.custom-card {  --background: var(--ion-color-primary-tint);}

Performance

Lazy Loading

  • Implement lazy loading for feature modules
  • Use loadChildren in routing configuration
  • Split code into logical chunks

Optimization

  • Use virtual scrolling for long lists
  • Implement proper image loading strategies
  • Minimize bundle size with tree shaking

Native Integration

Cordova/Capacitor Plugins

  • Use Ionic Native wrappers for native functionality
  • Implement web fallbacks for native features
  • Handle platform differences appropriately
typescript
import { Camera } from '@ionic-native/camera/ngx';
async takePicture() {  const image = await this.camera.getPicture(options);  return image;}

Firebase Integration

  • Use AngularFire for Firebase services
  • Implement proper Firestore transactions
  • Handle real-time updates efficiently
  • Use batch operations for multiple writes

Environment Configuration

  • Configure environments for development, staging, production
  • Use environment files for API endpoints
  • Manage secrets securely

Testing

  • Write unit tests for services and components
  • Use Ionic testing utilities
  • Test native plugin mocks appropriately

來源與署名

來源:mindrally/skills位於ionic提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架