Recently, I am using ionic to develop a program. I am writing down my mistakes and sharing them with you. I hope it will be helpful to others. The version numbers are as follows:

  • Ionic: 3.10.3
  • Cordova: 7.0.1

Ionic V3.3 is developing a pothole collection. If there is any conflict between the two, refer to this article.

  1. Setting the ion-nav TAB in the HTML of the subinterface automatically adds the return arrow and removes it in the rootPage. When debugging in the browser, save the modification of adding ion-nav, the browser will refresh automatically, but the modification is not displayed. Change the browser address to localhost:8100 and run it again. The reason is that saving the auto-refresh puts the child page in root, so the back key doesn’t appear.

  2. Ionic generate Page demo Create a new interface and jump from another interface. Error Cannot find module ‘.. /demo’, at this point try to interrupt the run and re-type ionic serve to run.

  3. Ionic time selector

    html:

     <ion-datetime displayFormat="YYYY year MM month" cancelText="Cancel" doneText="Sure" [(ngModel)]="myDate" (ngModelChange)="changeDate($event)"></ion-datetime>
    Copy the code

    ts:

     private myDate='the 2017-10'; Note: it must be written as' YYYY-MM-DD '. Do not write as' YYYY/MM/DD '. Do not use the same style as the ion-datetime tagCopy the code
  4. You can set the subinterface to hide tabs in app.module.ts as follows:

  import { ErrorHandler, NgModule } from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
  import { MyApp } from './app.component';
  @NgModule({
    declarations: [
     MyApp,
   ],
   imports: [
     BrowserModule,
    IonicModule.forRoot(MyApp, {
    tabsHideOnSubPages: true/ / is this, see: http://ionicframework.com/docs/api/config/Config/})], the bootstrap: [IonicApp], entryComponents: [ MyApp, ], providers: [] })export class AppModule { }
Copy the code
  1. Using Echarts, install directly through NPM, and then in the files you useimport echarts from 'echarts';Simple and convenient. This is essentially presents how to install third party js library, specific can see: https://segmentfault.com/q/1010000010230463

recommended

Last but not least, I would like to refer to ionic projects for beginners