Ionic3.0奇技淫巧(持續更新中)

一、全局自定義返回按鈕javascript

    在app.scss文件中,添加以下代碼css

imports: [
    IonicModule.forRoot(MyApp,{
      backButtonText: '',
      backButtonIcon: 'ios-arrow-back',
      iconMode: 'md'
    })
]

二、ios中,導航欄、狀態欄重疊java

IonicModule.forRoot(MyApp, {
      platforms: {
        ios: {
          statusbarPadding: true
        }
      },
      backButtonIcon:'ios-arrow-back',
      backButtonText:'',
      mode: 'ios',
      scrollAssist: false
    }, deepLinkConfig),
    IonicStorageModule.forRoot()
  ],

設置「statusbarPadding: true」解決。ios

三、路由配置npm

const deepLinkConfig: DeepLinkConfig = {
  links:[
    { component: MyApp, name: 'MyApp', segment: 'myApp' },
    { component: ContactPage, name: 'ContactPage', segment: 'contactPage' },
    { component: AboutPage, name: 'AboutPage', segment: 'aboutPage/:name/:age', defaultHistory: [ ContactPage ] }
  ]
}

component:組件app

segment:路由路徑ionic

defaultHistory:上一個頁面ui

四、在pc端部署時壓縮www方法:spa

從終端進入Ionic工程根目錄,執行如下命令code

npm run ionic:build --prod

五、集成js庫注意事項:

一、使用「var dsBridge=require("*****")」前,須要聲明「declare function require(path)」方法

相關文章
相關標籤/搜索