2017-09-18 7 views
0

나는 3D Touch Native Plugin을 이온 3 앱 3d-touch에서 사용합니다.3D 터치 이온 3 : 오픈 페이지

3D 터치 메뉴에서 응용 프로그램을 연 후에 페이지를 열려면 어떻게해야합니까?

에서 는

을 app.component.ts 내 코드 :

this.platform.ready().then(() => { 
    //3d Touch 
    this.threeDeeTouch.isAvailable().then((isAvailable) => { 
    if(isAvailable == true) { 
     let actions: Array<ThreeDeeTouchQuickAction> = [ 
     { 
      type: 'projects', 
      title: 'Projects', 
      iconType: 'Bookmark' 
     }, 
     { 
     type: 'messages', 
      title: 'Messages', 
      iconType: 'Message' 
     }, 
     ]; 
     this.threeDeeTouch.configureQuickActions(actions); 

     this.threeDeeTouch.onHomeIconPressed().subscribe((payload) => { 

     alert(payload.type) ; 

     //!!!!OPEN PAGE!!!! 

     }) ; 
    } 
    }); 
}) ; 

답변

1

당신은 탭 페이지 또는 탭으로 연결되지 않은 다른 페이지로 이동하려고합니까? 알려 주시면 정답을 알려 드리겠습니다. 그러나 앱에서 정상적인 페이지로 이동하려면 다음을 수행하십시오

app.component.ts을

import { ViewChild } from '@angular/core'; 
import { Nav } from 'ionic-angular'; 

export class MyApp { 

    @ViewChild(Nav) nav: Nav; 

constructor(private threeDeeTouch: ThreeDeeTouch) { 

//ThreeD Touch Configuration 
    this.threeDeeTouch.isAvailable().then(isAvailable => console.log('3D Touch available? ' + isAvailable)); 

    this.threeDeeTouch.watchForceTouches() 
     .subscribe(
     (data: ThreeDeeTouchForceTouch) => { 
      console.log('Force touch %' + data.force); 
      console.log('Force touch timestamp: ' + data.timestamp); 
      console.log('Force touch x: ' + data.x); 
      console.log('Force touch y: ' + data.y); 
     } 
    ); 

    let actions: Array<ThreeDeeTouchQuickAction> = [ 
     { 
     type: 'projects', 
     title: 'my projects', 
     subtitle: 'check our projects!', 
     iconType: 'bookmark' 
     }, 
     { 
     type: 'messages', 
     title: 'Messages', 
     subtitle: 'My Messages', 
     iconType: 'message' 
     } 
    ]; 

    this.threeDeeTouch.configureQuickActions(actions); 

    this.threeDeeTouch.onHomeIconPressed().subscribe(
    (payload) => { 
     // returns an object that is the button you presed 
     if (payload.type == 'projects') { 
      this.nav.push(ProjectsPage); 
     } else if (payload.type =='messages') { 
      this.nav.setRoot(MessagesPage); 

     console.log('Pressed the ${payload.title} button') 
     console.log(payload.type) 

    } 
    ) 

    }); 
    }