Flutter教程

ion-loading-controller

概要(CONTENTS)

Ionic4项目中我们可以使用Ionic4进度指示组件ion-loading-controller对项目进行布局。

ion-loading-controller官方文档地址:https://ionicframework.com/docs/api/loading-controller

Loading controllers programmatically control the loading component. Loadings can be created and dismissed from the loading controller. View the Loading documentation for a full list of options to pass upon creation.

ion-loading-controller 用法(Usage)

async function presentLoading() {
  const loadingController = document.querySelector('ion-loading-controller');
  await loadingController.componentOnReady();

  const loadingElement = await loadingController.create({
    message: 'Please wait...',
    spinner: 'crescent',
    duration: 2000
  });
  return await loadingElement.present();
}

ion-loading-controller 内置方法(Methods)

create

Description

Create a loading overlay with loading options.

Signature create(options?: LoadingOptions | undefined) => Promise

dismiss

Description

Dismiss the open loading overlay.

Signature dismiss(data?: any, role?: string | undefined, id?: string | undefined) => Promise

getTop

Description

Get the most recently opened loading overlay.

Signature getTop() => Promise