久久久久久久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. 主站蜘蛛池模板: 搞黄网站在线观看 | 久久国产综合 | 国产精品免费在线 | 国产精品毛片一区二区在线看 | 精品一区二区三区在线观看 | 成人免费视屏 | 成人av观看 | 日韩成人在线视频 | 一区二区三区免费观看 | 美女福利视频网站 | 中文字幕在线一区二区三区 | www.99re| 一级欧美一级日韩片免费观看 | av免费网| 国产精品久久久久久久久久久久久 | 午夜视频在线免费观看 | 国产精品国产三级国产aⅴ中文 | 亚洲精品高清视频 | 在线观看视频一区 | 国产精品久久国产精品 | www视频在线观看 | www久久久 | 色资源在线视频 | 国产免费色 | 在线激情视频 | 日韩一区二区三区在线观看视频 | 美女黄网 | 91精品国产综合久久久密闭 | 亚洲精品区 | 欧美一级片久久 | 欧美日韩成人影院 | 在线免费观看黄视频 | 热re99久久精品国99热观看 | 国产色婷婷久久99精品91 | 成人午夜精品 | 亚洲专区在线 | 一区二区精品 | 日韩一区二区三区在线看 | 精品国产欧美 | 三级黄色片在线 | 国产午夜视频 |