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

<legend id='8kFJm'><style id='8kFJm'><dir id='8kFJm'><q id='8kFJm'></q></dir></style></legend>

    1. <small id='8kFJm'></small><noframes id='8kFJm'>

      1. <tfoot id='8kFJm'></tfoot>
        <i id='8kFJm'><tr id='8kFJm'><dt id='8kFJm'><q id='8kFJm'><span id='8kFJm'><b id='8kFJm'><form id='8kFJm'><ins id='8kFJm'></ins><ul id='8kFJm'></ul><sub id='8kFJm'></sub></form><legend id='8kFJm'></legend><bdo id='8kFJm'><pre id='8kFJm'><center id='8kFJm'></center></pre></bdo></b><th id='8kFJm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8kFJm'><tfoot id='8kFJm'></tfoot><dl id='8kFJm'><fieldset id='8kFJm'></fieldset></dl></div>
          <bdo id='8kFJm'></bdo><ul id='8kFJm'></ul>
      2. 如何在 Ionic 中的選項(xiàng)卡之間傳遞數(shù)據(jù)

        How to pass data between tabs in Ionic(如何在 Ionic 中的選項(xiàng)卡之間傳遞數(shù)據(jù))
          <tbody id='fddwp'></tbody>
        <legend id='fddwp'><style id='fddwp'><dir id='fddwp'><q id='fddwp'></q></dir></style></legend>

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

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

                1. 本文介紹了如何在 Ionic 中的選項(xiàng)卡之間傳遞數(shù)據(jù)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我有一個(gè)帶有 3 個(gè)選項(xiàng)卡的簡(jiǎn)單項(xiàng)目.當(dāng)用戶點(diǎn)擊第一個(gè)選項(xiàng)卡上某個(gè)項(xiàng)目的按鈕時(shí),我需要該項(xiàng)目移動(dòng)到第二個(gè)選項(xiàng)卡,反之亦然.(發(fā)生這種情況時(shí),我還需要通知服務(wù)器).有什么方法可以讓我將項(xiàng)目對(duì)象傳遞給 About-Page 選項(xiàng)卡中的數(shù)組,反之亦然?

                  I have a simple project with 3 tabs. When the user hits a button on an item on the first tab I need that item to move to the second tab and vise versa. (I also need to notify a server when this happens). Is there any way for me to pass a item object to a array in the About-Page tab and vise versa?

                  home.html

                  <ion-header>
                    <ion-toolbar>
                      <ion-title>Home</ion-title>
                      <ion-buttons end>
                        <button ion-button icon-only color="royal" (click)="updateData()">
                          <ion-icon name="refresh"></ion-icon>
                        </button>
                      </ion-buttons>
                    </ion-toolbar>
                  </ion-header>
                  
                  <ion-content>
                    <ion-list>
                      <ion-item-sliding *ngFor="let item of items">
                        <ion-item>
                          <ion-icon name="alert" *ngIf="!item.taken" item-left></ion-icon>
                          <ion-icon name="checkmark-circle-outline" *ngIf="item.taken" item-left></ion-icon>
                          <h2><b>{{item.title}}</b></h2>
                          <h3>{{item.name}} | {{item.number}}</h3>
                          <h3 style="white-space: normal;"><b>Details:</b> {{item.text}}</h3>
                        </ion-item>
                        <ion-item-options side="left">
                          <button ion-button color="primary" (click)="smsPressed(item)">
                            <ion-icon name="text"></ion-icon>
                            Text
                          </button>
                          <button ion-button color="secondary" (click)="phonePressed(item)">
                            <ion-icon name="call"></ion-icon>
                            Call
                          </button>
                        </ion-item-options>
                        <ion-item-options side="right">
                          <button ion-button color="primary" *ngIf="item.taken" (click)="responderPressed(item)">
                            <ion-icon name="person"></ion-icon>
                            Responder
                          </button>
                          <button ion-button color="primary" *ngIf="!item.taken" (click)="takecallPressed(item)">
                            <ion-icon name="navigate"></ion-icon>
                            Take Call
                          </button>
                        </ion-item-options>
                      </ion-item-sliding>
                    </ion-list>
                  
                    <ion-fab right bottom>
                      <button ion-fab color="light" (click)="addItem()"><ion-icon name="add"></ion-icon></button>
                    </ion-fab>
                  </ion-content>
                  

                  home.ts

                  import { Component } from '@angular/core';
                  import { NavController } from 'ionic-angular';
                  import { AlertController } from 'ionic-angular';
                  
                  @Component({
                    selector: 'page-home',
                    templateUrl: 'home.html'
                  })
                  export class HomePage {
                    items: any[];
                  
                    constructor(public navCtrl: NavController, public alertCtrl: AlertController) {
                      this.items = []
                        this.items.push({
                          title: "Title",
                          text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pretium quam at est porta fringilla.",
                          name: "Sam",
                          number: "(555) 555-5555",
                          taken: true,
                          responder: {
                            name: "Bob",
                            phone: "(666) 666-6666"
                          }
                        })
                        this.items.push({
                          title: "Stuff",
                          text: "Take Now",
                          name: "Sam",
                          number: "(555) 555-5555",
                          taken: false,
                          responder: {}
                        })
                  
                    }
                  
                    buttonPressed(item){
                      alert(item.title)
                    }
                  
                    smsPressed(item){alert(item.number)}
                  
                    phonePressed(item){alert(item.number)}
                  
                    responderPressed(item){alert(item.responder.name)}
                  
                    takecallPressed(item){alert(item.taken)}
                  
                    updateData(){
                      this.items.unshift({
                        title: "Added",
                        text: "Take Now",
                        name: "Sam",
                        number: "(555) 555-5555",
                        taken: false,
                        responder: {}
                      })
                    }
                  
                    addItem(){
                      let prompt = this.alertCtrl.create({
                        title: 'Add Call',
                        message: "Enter the details for the call you want to add",
                        inputs: [
                          { name: 'title',  placeholder: 'Title'},
                          { name: 'text',  placeholder: 'Details'},
                          { name: 'name',  placeholder: 'Name'},
                          { name: 'number',  placeholder: 'Number'},
                        ],
                        buttons: [
                          { text: 'Cancel',handler: data => {}},
                          { text: 'Save',handler: data => {
                              this.items.unshift({
                                title: data.title,text: data.text,
                                name: data.name,number: data.number,
                                taken: false,responder: {}
                              })
                            }
                          }
                        ]
                      });
                      prompt.present();
                    }
                  }
                  

                  tabs.html

                  <ion-tabs>
                        <ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
                        <ion-tab [root]="tab2Root" tabTitle="Current" tabIcon="alarm"></ion-tab>
                        <ion-tab [root]="tab3Root" tabTitle="Account" tabIcon="contacts"></ion-tab>
                  </ion-tabs>
                  

                  tabs.ts

                  import { Component } from '@angular/core';
                  import { HomePage } from '../home/home';
                  import { AboutPage } from '../about/about';
                  import { ContactPage } from '../contact/contact';
                  
                  @Component({
                    templateUrl: 'tabs.html'
                  })
                  export class TabsPage {
                    // this tells the tabs component which Pages
                    // should be each tab's root Page
                    tab1Root: any = HomePage;
                    tab2Root: any = AboutPage;
                    tab3Root: any = ContactPage;
                  
                    constructor() {
                  
                    }
                  }
                  

                  推薦答案

                  有幾種方法可以實(shí)現(xiàn).

                  1. Events 將是傳遞數(shù)據(jù)的正確選擇不同頁(yè)面之間.

                  1. Events would be the right choice when it comes to passing data between different pages.

                  Events 是一個(gè)發(fā)布-訂閱風(fēng)格的事件系統(tǒng),用于發(fā)送和在您的應(yīng)用中響應(yīng)應(yīng)用級(jí)事件.

                  Events is a publish-subscribe style event system for sending and responding to application-level events across your app.

                  創(chuàng)建一個(gè)事件

                  constructor(public events: Events) {}
                  function sendData(data) {
                    events.publish('data:created', data);
                  }
                  

                  使用訂閱它

                  events.subscribe('data:created', (data) => {控制臺(tái).log(數(shù)據(jù));});

                  <小時(shí)>

                  1. 使用共享服務(wù)

                  1. Use a shared service

                  構(gòu)造函數(shù)(公共共享:共享){}推送數(shù)據(jù)(數(shù)據(jù)){this.shared.items.push(data);}

                  app.module.ts中全局注入服務(wù)時(shí),可以使用this.shared.items訪問(wèn)其他組件中的items/p>

                  You can access items in other components using this.shared.items when you inject the service globally in app.module.ts

                  <小時(shí)>

                  1. 另一種選擇是使用 segments 而不是 tabs.這取決于用例.對(duì)于簡(jiǎn)單的應(yīng)用程序,這將是更好的解決方案.您可以從文檔了解更多信息.
                  1. Another option would be to use segments instead of tabs. This depends on the use case. For simple applications, this would be the better solution. You can learn more from the documentation.

                  編輯

                  我避免將數(shù)據(jù)存儲(chǔ)在數(shù)據(jù)庫(kù)中,因?yàn)樗皇且环N有效的方法.但這種方法可能會(huì)有用例.

                  I have avoided storing the data in database as its not an efficient way to do this. But there may be use cases for such an approach.

                  這篇關(guān)于如何在 Ionic 中的選項(xiàng)卡之間傳遞數(shù)據(jù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項(xiàng)目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 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 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動(dòng)態(tài)元素 - Angular 2 amp;離子2)
                  <tfoot id='Rn3k8'></tfoot>
                  <i id='Rn3k8'><tr id='Rn3k8'><dt id='Rn3k8'><q id='Rn3k8'><span id='Rn3k8'><b id='Rn3k8'><form id='Rn3k8'><ins id='Rn3k8'></ins><ul id='Rn3k8'></ul><sub id='Rn3k8'></sub></form><legend id='Rn3k8'></legend><bdo id='Rn3k8'><pre id='Rn3k8'><center id='Rn3k8'></center></pre></bdo></b><th id='Rn3k8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Rn3k8'><tfoot id='Rn3k8'></tfoot><dl id='Rn3k8'><fieldset id='Rn3k8'></fieldset></dl></div>

                  1. <legend id='Rn3k8'><style id='Rn3k8'><dir id='Rn3k8'><q id='Rn3k8'></q></dir></style></legend>
                      • <bdo id='Rn3k8'></bdo><ul id='Rn3k8'></ul>

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

                            <tbody id='Rn3k8'></tbody>
                          1. 主站蜘蛛池模板: 亚洲视频不卡 | 午夜美女福利 | 欧美性爽 | 欧美激情亚洲 | 亚洲精品在线观看视频 | 久久久久久亚洲 | 欧美激情三区 | 91色国产 | 男女激情视频网站 | 国产一区二区三区视频在线 | 91日韩欧美 | 成人手机在线观看 | 国产三级一区 | 欧美视频免费在线观看 | 九月丁香婷婷 | 国产成人综合网 | 日韩免费三级 | 亚洲国产精品久久久 | аⅴ资源新版在线天堂 | 不卡视频在线观看 | 91成人精品| 黄色网址视频 | 国产免费黄色片 | 欧美天天干 | 国产一级大片 | 日韩专区中文字幕 | 黄色一级片网站 | 操操操干干干 | 国产精品视频一区二区三区 | 国产欧美精品一区二区 | 福利网站在线观看 | 免费观看一级一片 | 午夜美女福利 | 中文字幕亚洲精品 | 黄色一级片网站 | 日韩和的一区二区 | 欧美专区在线观看 | 黄色xxxxx | 国产精品一区二区三区免费 | 伊人干综合 | 91网站免费 |