getMenuButtonBoundingClientRect
获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
引入
import { getMenuButtonBoundingClientRect } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.3.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
width | number | 宽度,单位:px |
height | number | 高度,单位:px |
top | number | 上边界坐标,单位:px |
right | number | 右边界坐标,单位:px |
bottom | number | 下边界坐标,单位:px |
left | number | 左边界坐标,单位:px |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
getMenuButtonBoundingClientRectSync
获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。同步方法
引入
import { getMenuButtonBoundingClientRectSync } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.3.0
版本才可使用getMenuButtonBoundingClientRect 的同步版本
返回值
属性 | 类型 | 说明 |
---|---|---|
width | number | 宽度,单位:px |
height | number | 高度,单位:px |
top | number | 上边界坐标,单位:px |
right | number | 右边界坐标,单位:px |
bottom | number | 下边界坐标,单位:px |
left | number | 左边界坐标,单位:px |
preDownloadMiniApp
预下载智能小程序,此接口仅供提供预下载普通智能小程序调用,面板小程序的预下载需要使用另外的接口。
引入
import { preDownloadMiniApp } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.3.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
miniAppId | string | 是 | 小程序 id | |
miniAppVersion | string | 否 | 指定小程序版本(可选参数) | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
showMenuButton
显示右上角胶囊按钮
引入
import { showMenuButton } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.5.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
hideMenuButton
隐藏右上角胶囊按钮
引入
import { hideMenuButton } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.5.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
setPageOrientation
屏幕旋转设置,auto / portrait / landscape。pad 模式下不支持屏幕旋转
引入
import { setPageOrientation } from '@ray-js/ray';
需引入
MiniKit
,且在>=2.4.1
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
pageOrientation | string | 是 | 屏幕旋转设置, auto(暂不支持) / portrait / landscape | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
share
分享
引入
import { share } from '@ray-js/ray';
需引入
BizKit
,且在>=3.0.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
type | string | 是 | 分享渠道,可选值如下: WeChat:微信 Message:短信 Email:邮件 More:系统更多分享渠道(调用系统分享) | |
title | string | 是 | title 标题 | |
message | string | 是 | message 文本内容 | |
contentType | string | 是 | contentType 内容类型 空值默认为 text 可选值如下: text:文本 image:图片 file:文件 web:网页地址 miniProgram:微信小程序分享内容 | |
recipients | array | 否 | recipients 邮件收件人 | |
imagePath | string | 否 | imagePath 图片路径 | |
filePath | string | 否 | filePath 当 contentType == file 时候使用 | |
webPageUrl | string | 否 | web 当 contentType == file 时候使用 | |
miniProgram Info | MiniProgramInfo | 否 | miniProgramInfo 当 contentType == miniProgram 时候使用,且分享渠道必须是微信。 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
MiniProgramInfo
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
userName | string | 是 | 用户名称 | |
path | string | 是 | 路径 | |
hdImagePath | string | 是 | 图片地址 | |
withShareTicket | boolean | 是 | ticket | |
miniProgramType | number | 是 | 类型 | |
webPageUrl | string | 是 | 小程序地址 |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。