Ionic3 多级侧边菜单项目教程
Ionic3-MultiLevelSideMenuIonic 3 demo of a two-level side menu. 项目地址:https://gitcode.com/gh_mirrors/io/Ionic3-MultiLevelSideMenu
1. 项目的目录结构及介绍
Ionic3-MultiLevelSideMenu/
├── src/
│ ├── app/
│ │ ├── app.component.ts
│ │ ├── app.module.ts
│ │ ├── app-routing.module.ts
│ │ └── ...
│ ├── assets/
│ ├── environments/
│ ├── theme/
│ └── ...
├── ionic.config.json
├── package.json
├── tsconfig.json
└── ...
目录结构介绍
- src/: 包含项目的源代码。
- app/: 包含应用程序的主要组件和模块。
- app.component.ts: 应用程序的根组件。
- app.module.ts: 应用程序的根模块。
- app-routing.module.ts: 应用程序的路由配置。
- assets/: 存放静态资源文件,如图片、字体等。
- environments/: 存放不同环境下的配置文件。
- theme/: 存放主题相关的样式文件。
- ionic.config.json: Ionic 项目的配置文件。
- package.json: 项目的依赖和脚本配置文件。
- tsconfig.json: TypeScript 编译配置文件。
2. 项目的启动文件介绍
app.component.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = 'HomePage';
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
});
}
}
介绍
- MyApp: 应用程序的根组件,负责初始化应用并设置根页面。
- rootPage: 设置应用启动时的默认页面。
- constructor: 初始化平台、状态栏和启动画面。
3. 项目的配置文件介绍
ionic.config.json
{
"name": "multilevel-menu",
"integrations": {},
"type": "angular"
}
介绍
- name: 项目的名称。
- integrations: 集成的配置,如 Cordova 等。
- type: 项目的类型,这里是 Angular 项目。
package.json
{
"name": "multilevel-menu",
"version": "0.0.1",
"author": "Sebastian Ferreras",
"homepage": "https://github.com/sebaferreras/Ionic3-MultiLevelSideMenu",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~7.2.2",
"@angular/core": "~7.2.2",
"@angular/forms": "~7.2.2",
"@angular/http": "~7.2.2",
"@angular/platform-browser": "~7.2.2",
"@angular/platform-browser-dynamic": "~7.2.2",
"@angular/router": "~7.2.2",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.0",
"@angular/compiler": "~7.2.2
Ionic3-MultiLevelSideMenuIonic 3 demo of a two-level side menu. 项目地址:https://gitcode.com/gh_mirrors/io/Ionic3-MultiLevelSideMenu