showLoading(params: Object)

版本要求:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { showLoading } from '@ray-js/ray';

// Promise 调用
try {
  const res = await showLoading({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

显示 loading 提示框。需主动调用 thing.hideLoading 才能关闭提示框

参数

属性类型必填默认值说明
titlestring是-提示的内容
maskboolean否false是否显示透明蒙层,防止触摸穿透
complete() => void否-接口调用结束的回调函数(调用成功、失败都会执行)
success() => void否-接口调用成功的回调函数
fail(params: Object) => void否-接口调用失败的回调函数
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

import { showLoading } from '@ray-js/ray'

// 显示 loading 提示框,需主动调用 hideLoading 关闭
showLoading({
  title: "加载中...",
  mask: true,
  success: () => console.log("loading 已显示"),
  fail: error => console.error(error),
});