mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
refactor(all): data -> componentProps
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import { Component, Element, Listen, Prop } from '@stencil/core';
|
||||
import { ComponentProps } from '../..';
|
||||
import { NavComponent } from '../nav/nav-util';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-nav-set-root',
|
||||
@ -6,16 +8,16 @@ import { Component, Element, Listen, Prop } from '@stencil/core';
|
||||
export class NavSetRoot {
|
||||
|
||||
@Element() el: HTMLElement;
|
||||
@Prop() component: any;
|
||||
@Prop() component: NavComponent;
|
||||
@Prop() componentProps: ComponentProps;
|
||||
@Prop() url: string;
|
||||
@Prop() data: any;
|
||||
|
||||
@Listen('child:click')
|
||||
push(): Promise<any> {
|
||||
const nav = this.el.closest('ion-nav');
|
||||
if (nav) {
|
||||
const toPush = this.url || this.component;
|
||||
return nav.setRoot(toPush, this.data);
|
||||
return nav.setRoot(toPush, this.componentProps);
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user