久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<small id='RSdmD'></small><noframes id='RSdmD'>

    <tfoot id='RSdmD'></tfoot>
        <bdo id='RSdmD'></bdo><ul id='RSdmD'></ul>

        <i id='RSdmD'><tr id='RSdmD'><dt id='RSdmD'><q id='RSdmD'><span id='RSdmD'><b id='RSdmD'><form id='RSdmD'><ins id='RSdmD'></ins><ul id='RSdmD'></ul><sub id='RSdmD'></sub></form><legend id='RSdmD'></legend><bdo id='RSdmD'><pre id='RSdmD'><center id='RSdmD'></center></pre></bdo></b><th id='RSdmD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RSdmD'><tfoot id='RSdmD'></tfoot><dl id='RSdmD'><fieldset id='RSdmD'></fieldset></dl></div>
        <legend id='RSdmD'><style id='RSdmD'><dir id='RSdmD'><q id='RSdmD'></q></dir></style></legend>

      1. 如何使用 ionic2 框架創建或自定義 Toast 視圖

        How to create or customize a Toast view using ionic2 framework(如何使用 ionic2 框架創建或自定義 Toast 視圖)

          <tbody id='47JoK'></tbody>
          <bdo id='47JoK'></bdo><ul id='47JoK'></ul>
          <i id='47JoK'><tr id='47JoK'><dt id='47JoK'><q id='47JoK'><span id='47JoK'><b id='47JoK'><form id='47JoK'><ins id='47JoK'></ins><ul id='47JoK'></ul><sub id='47JoK'></sub></form><legend id='47JoK'></legend><bdo id='47JoK'><pre id='47JoK'><center id='47JoK'></center></pre></bdo></b><th id='47JoK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='47JoK'><tfoot id='47JoK'></tfoot><dl id='47JoK'><fieldset id='47JoK'></fieldset></dl></div>

              <legend id='47JoK'><style id='47JoK'><dir id='47JoK'><q id='47JoK'></q></dir></style></legend>
              <tfoot id='47JoK'></tfoot>

              1. <small id='47JoK'></small><noframes id='47JoK'>

                • 本文介紹了如何使用 ionic2 框架創建或自定義 Toast 視圖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我是 ionic2 開發的新手.嘗試向用戶顯示 toast 消息,但是使用 ionic2 框架只能在 toast 視圖中顯示字符串消息,我想以自定義視圖的形式顯示圖像和一些其他字符串.我該怎么做.

                  我從 ionic 網站獲得了這個鏈接,上面說我們可以顯示字符串.

                  這個想法是使用 Ionic2 的 ModalController,但使用 ugly 和小的解決方法來修改該模式的樣式,而不影響應用程序的其他模式.

                  當頁面顯示時(即使它被用作模式頁面),組件的名稱用于在 html 代碼中的 元素中設置一個類.我們將使用該類來設置模態框的樣式,使其看起來像 Toast,但要利用頁面來顯示其內容,以便我們可以放置圖像和其他一些東西.

                  對于這個演示,我創建了一個帶有兩個按鈕的頁面:

                  <ion-header><離子導航欄><ion-title>ModalController 演示</ion-title></離子導航欄></離子頭><離子含量填充><h5>具有自定義大小的模態控制器</h5><button(click)="presentCustomModal()">打開自定義Modal</button><button(click)="presentDefaultModal()">打開默認模態</button></離子含量>

                  并使用以下代碼:

                  從'@angular/core'導入{組件};導入 { NavController, ModalController, ViewController } from 'ionic-angular';@零件({templateUrl: 'build/pages/modal-controller-custom-size/modal-controller-custom-size.html',})導出類 ModalControllerCustomSizePage {構造函數(私有 navCtrl:NavController,私有 modalCtrl:ModalController){}presentCustomModal() {讓 customModal = this.modalCtrl.create(CustomModalPage);customModal.onDidDismiss(() => {//做你想做的...});//呈現模態customModal.present();}presentDefaultModal() {讓 defaultModal = this.modalCtrl.create(DefaultModalPage);defaultModal.onDidDismiss(() => {//做你想做的...});//呈現模態defaultModal.present();}}/* ********************自定義模態************************ */@零件({模板:'<離子頭>'+'<ion-navbar dark>'+'<ion-title>我的自定義模態</ion-title>'+'<離子按鈕結束>'+'<button (click)="dismiss()">關閉</button>'+'</離子按鈕>'+'</離子導航欄>'+'</離子頭>'+'<離子含量填充>'+'<離子網格>'+'<離子行>'+'<ion-col width-50><img src="http://placehold.it/150x150"/></ion-col>'+'<ion-col width-50>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</ion-col>'+'</離子行>'+'</離子網格>'+'</離子含量>',})類 CustomModalPage {構造函數(公共 viewCtrl:ViewController){}公開解雇(){this.viewCtrl.dismiss();}}/* ********************默認模態************************ */@零件({模板:'<離子頭>'+'<離子導航欄>'+'<ion-title>默認模式</ion-title>'+'<離子按鈕結束>'+'<button (click)="dismiss()">關閉</button>'+'</離子按鈕>'+'</離子導航欄>'+'</離子頭>'+'<離子含量填充>'+'<h5>模態內容...</h5>'+'</離子含量>',})類 DefaultModalPage {構造函數(公共 viewCtrl:ViewController){}公開解雇(){this.viewCtrl.dismiss();}}

                  請注意,我在同一頁面中包含了將用作模式的兩個組件的代碼,只是為了使代碼更易于閱讀.推薦的方法是將每個 Component 放在自己的 .ts 文件中.

                  到目前為止,該代碼沒有什么特別之處,只是一個打開兩個不同(但整頁)模式的頁面.魔術將通過使用這些樣式規則來完成:

                  .custom-modal-page {高度:270px;位置:絕對;頂部:計算(100% - 270px);離子含量{背景顏色:#333;顏色:#eee;}}

                  由于我們使用的是 .custom-modal-page 類,因此這些更改只會影響自定義模式,而不影響默認模式.

                  I am new to ionic2 development. Trying to show a toast message to the user, However using ionic2 framework am able to display only string message's in the toast view, I want to display a image and few other string in the form of customized view. How can i do that.

                  I got this link from ionic site which says we can display string's. http://ionicframework.com/docs/v2/api/components/toast/ToastController/

                  Any suggestions ?

                  解決方案

                  I've been playing around with this, and I think I found a workaround, but please notice that this is just that, a workaround, and may cause some other things to break somehow.

                  The final result is something like this:

                  The idea is to use Ionic2's ModalController but using an ugly and small workaround to modify the styles of that modal without affecting other modals of the app.

                  When a page is shown (even though if it's used as a modal page) the Component's name is used to set a class in the <ion-page> element in the html code. We're going to use that class to style a modal to make it look like a Toast, but taking advantage of using a page for it's content so we can put an image and some other things.

                  For this demo, I've created a page with two buttons:

                  <ion-header>
                  
                    <ion-navbar>
                      <ion-title>ModalController Demo</ion-title>
                    </ion-navbar>
                  
                  </ion-header>
                  
                  <ion-content padding>
                      <h5>ModalController with custom size</h5>
                  
                      <button (click)="presentCustomModal()">Open Custom Modal</button>
                  
                      <button (click)="presentDefaultModal()">Open Default Modal</button>
                  
                  </ion-content>
                  

                  And with the following code:

                  import { Component } from '@angular/core';
                  import { NavController, ModalController, ViewController } from 'ionic-angular';
                  
                  @Component({
                      templateUrl: 'build/pages/modal-controller-custom-size/modal-controller-custom-size.html',
                  })
                  export class ModalControllerCustomSizePage {
                  
                      constructor(private navCtrl: NavController, private modalCtrl: ModalController) {
                  
                      }
                  
                      presentCustomModal() {
                          let customModal = this.modalCtrl.create(CustomModalPage);
                  
                          customModal.onDidDismiss(() => {
                              // Do what you want ...
                          });
                  
                          // Present the modal
                          customModal.present();
                      }
                  
                      presentDefaultModal() {
                          let defaultModal = this.modalCtrl.create(DefaultModalPage);
                  
                          defaultModal.onDidDismiss(() => {
                              // Do what you want ...
                          });
                  
                          // Present the modal
                          defaultModal.present();
                      }
                  
                  }
                  
                  /* ********************
                      Custom modal 
                  ********************* */
                  @Component({
                      template:   '<ion-header>' +
                                      '<ion-navbar dark>' +
                                          '<ion-title>My custom modal</ion-title>' +
                                          '<ion-buttons end>' +
                                              '<button (click)="dismiss()">Close</button>' +
                                          '</ion-buttons>' +
                                      '</ion-navbar>' +
                                  '</ion-header>' +
                                  '<ion-content padding>' +
                                      '<ion-grid>' +
                                          '<ion-row>' +
                                              '<ion-col width-50><img src="http://placehold.it/150x150"/></ion-col>' +
                                              '<ion-col width-50>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</ion-col>' +
                                          '</ion-row>' +
                                      '</ion-grid>' +
                                  '</ion-content>',
                  })
                  class CustomModalPage {
                  
                      constructor(public viewCtrl: ViewController) {
                  
                      }
                  
                      public dismiss() {
                          this.viewCtrl.dismiss();
                      }
                  }
                  
                  /* ********************
                      Default modal 
                  ********************* */
                  @Component({
                      template:   '<ion-header>' +
                                      '<ion-navbar>' +
                                          '<ion-title>Default modal</ion-title>' +
                                          '<ion-buttons end>' +
                                              '<button (click)="dismiss()">Close</button>' +
                                          '</ion-buttons>' +
                                      '</ion-navbar>' +
                                  '</ion-header>' +
                                  '<ion-content padding>' +
                                      '<h5>Modal content...</h5>' +
                                  '</ion-content>',
                  })
                  class DefaultModalPage {
                  
                      constructor(public viewCtrl: ViewController) {
                  
                      }
                  
                      public dismiss() {
                          this.viewCtrl.dismiss();
                      }
                  }
                  

                  Please notice that I included the code of the two components that are going to be used as modals in the same page, just to make the code easier to read. The recommended approach is to put every Component in its own .ts file.

                  Until now there's nothing special in that code, is just a page that opens two different (but full-page) modals. The magic will be done by using these style rules:

                  .custom-modal-page {
                      height: 270px;
                      position: absolute;
                      top: calc(100% - 270px);
                  
                      ion-content {
                          background-color: #333;
                          color: #eee;
                      }
                  }
                  

                  Since we're using the .custom-modal-page class, those changes will only affect the custom modal and not the default one.

                  這篇關于如何使用 ionic2 框架創建或自定義 Toast 視圖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  <small id='2lfjU'></small><noframes id='2lfjU'>

                      <legend id='2lfjU'><style id='2lfjU'><dir id='2lfjU'><q id='2lfjU'></q></dir></style></legend>

                          <bdo id='2lfjU'></bdo><ul id='2lfjU'></ul>
                          <i id='2lfjU'><tr id='2lfjU'><dt id='2lfjU'><q id='2lfjU'><span id='2lfjU'><b id='2lfjU'><form id='2lfjU'><ins id='2lfjU'></ins><ul id='2lfjU'></ul><sub id='2lfjU'></sub></form><legend id='2lfjU'></legend><bdo id='2lfjU'><pre id='2lfjU'><center id='2lfjU'></center></pre></bdo></b><th id='2lfjU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2lfjU'><tfoot id='2lfjU'></tfoot><dl id='2lfjU'><fieldset id='2lfjU'></fieldset></dl></div>
                            <tbody id='2lfjU'></tbody>
                          <tfoot id='2lfjU'></tfoot>

                          1. 主站蜘蛛池模板: 日韩欧美精品一区 | 欧美极品视频 | 国产成人精品免费视频大全最热 | h在线| 日本天天操 | a亚洲精品 | 国产麻豆乱码精品一区二区三区 | 国产一区二区在线播放 | 欧美一级片久久 | 久久精品男人的天堂 | 怡红院成人在线视频 | 亚洲综合一区二区三区 | 国产亚洲精品美女久久久久久久久久 | 成人水多啪啪片 | 黄色av网站免费看 | 国产色视频网站 | 在线观看黄免费 | 久久国产精品精品国产色婷婷 | 风间由美一区二区三区在线观看 | 国产精品久久一区二区三区 | 一区二区三区中文字幕 | 国产婷婷色一区二区三区 | 国产在线观看av | 亚洲精彩视频 | 国产日韩一区二区三免费高清 | 欧美日韩综合一区 | 日日碰狠狠躁久久躁96avv | 亚洲免费成人av | 久久九九色 | 国产精品毛片av一区 | 91精品国产高清一区二区三区 | 欧美日韩国产精品一区 | 成人在线播放网站 | 网站国产| 欧美成视频在线观看 | 91精产国品一二三区 | 国产精品网页 | 亚洲二区视频 | 国产98色在线 | 日韩 | 久久久www| 日韩精品视频在线免费观看 |