preDownloadMiniApp(params: Object)

版本要求:
MiniKit≥2.3.0@ray-js/ray≥0.3.23
支持平台:
iOSAndroid
import { preDownloadMiniApp } from '@ray-js/ray';

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

描述

预下载智能小程序,此接口仅供提供预下载普通智能小程序调用,面板小程序的预下载需要使用另外的接口。

参数

属性类型必填说明
miniAppIdstring是小程序id
miniAppVersionstring否指定小程序版本(可选参数)
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success() => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

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

preDownloadMiniApp({
  miniAppId: "tyxxxxxxxxxxxxxxxx",
  success: data => { console.log(data); },
  fail: error => { console.error(error); },
});