title: Taro.showLoading(option)

sidebar_label: showLoading

Displays the loading prompt box. Taro.hideLoading must be called to close the prompt box.

Note

  • Either Taro.showLoading or Taro.showToast can be displayed.
  • Taro.showLoading should be paired with Taro.hideLoading.

Reference

Type

  1. (option: Option) => Promise<CallbackResult>

Parameters

Option

Property Type Required Description
title string Yes Prompt content
mask boolean No Indicates whether to display a transparent mask to prevent touch penetration
complete (res: CallbackResult) => void No The callback function used when the API call completed (always executed whether the call succeeds or fails)
fail (res: CallbackResult) => void No The callback function for a failed API call
success (res: CallbackResult) => void No The callback function for a successful API call

Sample Code

  1. Taro.showLoading({
  2. title: 'loading',
  3. })
  4. setTimeout(function () {
  5. Taro.hideLoading()
  6. }, 2000)

API Support

API WeChat Mini-Program H5 React Native
Taro.showLoading ✔️ ✔️ ✔️