关于通信录这个页面的布局,此处不进行介绍;下面主要是说明Ionic1.0和Ionic3.0的实现间的差别。html
1、Ionic1.0版本git
2、Ionic3.0版本github
在这个版本中,主要是依赖<ion-content>这个标签的属性及方法,实例代码以下:ionic
***.html <ion-content> Add your content here! </ion-content> ***.ts import { Component, ViewChild } from '@angular/core'; import { Content } from 'ionic-angular'; @Component({...}) export class MyPage{ @ViewChild(Content) content: Content; scrollToTop() { this.content.scrollToTop(); } }
在实现经过字母来定位对应的分组时,主要是使用到了scrollTo(x, y, duration)
的方法,具体偏移量是多少,根据实际要求进行计算得出;布局
PS:this
一、在实现通信录这个功能时,能够给item添加sticky,能够实现字母表头的悬浮效果;code
二、另外能够github有一个开源库htm