📜  选择时离子将视图移动到页面顶部 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:35.749000             🧑  作者: Mango

代码示例2
import { Component, OnInit, ViewChild } from '@angular/core';
import { IonContent } from '@ionic/angular';

@Component({
  selector: 'app-tab2',
  templateUrl: './tab2.page.html',
  styleUrls: ['./tab2.page.scss'],
})
export class Tab2Page implements OnInit {

  @ViewChild(IonContent) private content: IonContent;

  constructor() { }

  ngOnInit() {
  }

  ionViewWillEnter() {
    this.content.scrollToTop();
  }

}