ionic3 - 页面不使用动画 ionic3 过渡
问题描述
我试图通过向前动画页面从主页导航到聊天页面,但页面总是从底部弹出,我的代码是
goTochat(friendId){
this.provider.setUser(friendId);
setTimeout(() => {
this.navCtrl.push(ChatPage, {}, { animate: true, direction: 'forward' });
},20)
}
我哪里错了!请帮忙!
解决方案
您是否在 Android 设备上进行测试?我认为这是默认动画。
如果要指定页面转换,可以使用: https ://ionicframework.com/docs/native/native-page-transitions/
import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
constructor(private nativePageTransitions: NativePageTransitions) { }
...
// example of adding a transition when a page/modal closes
ionViewWillLeave() {
let options: NativeTransitionOptions = {
direction: 'up',
duration: 500,
slowdownfactor: 3,
slidePixels: 20,
iosdelay: 100,
androiddelay: 150,
fixedPixelsTop: 0,
fixedPixelsBottom: 60
};
this.nativePageTransitions.slide(options)
.then(onSuccess)
.catch(onError);
}
// example of adding a transition when pushing a new page
openPage(page: any) {
this.nativePageTransitions.slide(options);
this.navCtrl.push(page);
}
推荐阅读
- security - 站点范围的身份验证方法?
- javascript - 第一个技巧,就是errorHandler
- java - 如何在 Java 中不断提示正确的用户输入?
- python-3.x - 我应该将计数放在这个 tim 排序算法中的哪个位置,以便准确地将运行时间与其他算法进行比较
- tensorflow - 遇到 ModuleNotFoundError:当我使用 Tensorflow GPU 处理时,没有名为“tensorflow.contrib”的模块
- python-3.x - 在python中创建一个方阵
- python - 为什么我的递归函数之外的变量没有保持它们的值?
- python - 制作火炬数据集错误“无法从'dataloader'导入名称'read_data_sets'”
- sql-server - 使用 VB.net App 修复 SqlConnection 中的 System.TypeInitializationException 错误
- c - 如何编写 ARM 子程序并从 C 中调用它