Skip to main content
Use this API to display a loading indicator in the navigation bar of the current page. This provides visual feedback to users during asynchronous operations.

Parameters

This API does not require any parameters.

Code Example

Basic Usage

my.showNavigationBarLoading();

With Network Request

Page({
  async fetchData() {
    // Show loading indicator
    my.showNavigationBarLoading();

    try {
      const res = await my.request({
        url: 'https://api.example.com/data'
      });
      this.setData({ items: res.data });
    } finally {
      // Hide loading indicator
      my.hideNavigationBarLoading();
    }
  }
});

With Pull-down Refresh

Page({
  onPullDownRefresh() {
    my.showNavigationBarLoading();

    this.refreshData().then(() => {
      my.hideNavigationBarLoading();
      my.stopPullDownRefresh();
    });
  }
});
Always pair my.showNavigationBarLoading() with my.hideNavigationBarLoading() to ensure the loading indicator is properly removed when the operation completes.

my.hideNavigationBarLoading

Hide the loading indicator

my.showLoading

Show fullscreen loading