Parameters
This API does not require any parameters.Code Example
Basic Usage
With Network Request
With Pull-down Refresh
Related APIs
my.hideNavigationBarLoading
Hide the loading indicator
my.showLoading
Show fullscreen loading
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Show a loading animation in the navigation bar.
my.showNavigationBarLoading();
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();
}
}
});
Page({
onPullDownRefresh() {
my.showNavigationBarLoading();
this.refreshData().then(() => {
my.hideNavigationBarLoading();
my.stopPullDownRefresh();
});
}
});
my.showNavigationBarLoading() with my.hideNavigationBarLoading() to ensure the loading indicator is properly removed when the operation completes.