前端 - ionic 3怎样更改页面push的速度?
本文介绍了前端 - ionic 3怎样更改页面push的速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
在官网看到NavController的这几个方法,但是不知道怎么用animate
boolean
Whether or not the transition should animate.
animation
string
What kind of animation should be used.
direction
string
The conceptual direction the user is navigating. For example, is the user navigating forward, or back?
duration
number
The length in milliseconds the animation should take.
easing
string
The easing for the animation.
解决方案
源码是这么写的
abstract push(page: Page | string, params?: any, opts?: NavOptions, done?: Function): Promise<any>;
其中NavOptions
里面包含了
export interface NavOptions {
animate?: boolean;
animation?: string;
direction?: string;
duration?: number;
easing?: string;
id?: string;
keyboardClose?: boolean;
progressAnimation?: boolean;
disableApp?: boolean;
minClickBlockDuration?: number;
ev?: any;
updateUrl?: boolean;
isNavRoot?: boolean;
}
你所要的速度就是direction
说了那么多,你要写的代码就是
constructor(public navCtrl: NavController) {}
push() {
this.navCtrl.push(page, null, {
direction: 0 // 毫秒
});
}
这篇关于前端 - ionic 3怎样更改页面push的速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文