# uni.showActionSheet(options) GitCodeGitHub

从底部向上弹出操作菜单

# showActionSheet 兼容性

Web 微信小程序 Android iOS iOS uni-app x UTS 插件 HarmonyOS
4.0 4.41 3.91 4.11 4.11 4.61

# 参数

名称 类型 必填 默认值 兼容性 描述
options ShowActionSheetOptions -
-
uni.showActionSheet函数参数定义
名称 类型 必备 默认值 兼容性 描述
title string -
-
菜单标题
alertText string -
-
警示文案(仅微信小程序真机有效)
itemList Array<string> -
-
按钮的文字数组
itemColor string.ColorString -
-
按钮的文字颜色,字符串格式
popover Popover -
-
大屏设备弹出原生选择按钮框的指示区域,默认居中显示
名称 类型 必备 默认值 兼容性 描述
top number -
-
指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度
left number -
-
指示区域坐标
width number -
-
指示区域宽度
height number -
-
指示区域高度
titleColor string.ColorString -
菜单标题文字颜色,字符串格式
cancelText string -
取消按钮的文字,默认为"取消"
cancelColor string.ColorString -
取消按钮的文字颜色,字符串格式
backgroundColor string.ColorString -
弹框背景颜色
success (result: ShowActionSheetSuccess) => void -
-
接口调用成功的回调函数
fail (result: ShowActionSheetFail) => void -
-
接口调用失败的回调函数
complete (result: any) => void -
-
接口调用结束的回调函数(调用成功、失败都会执行)

# ShowActionSheetSuccess 的属性值

名称 类型 必备 默认值 兼容性 描述
errMsg string -
-
tapIndex number -
-

# ShowActionSheetFail 的属性值

名称 类型 必备 默认值 兼容性 描述
errCode number -
-
showActionSheet 错误码
- 4: 框架内部异常
errSubject string -
-
统一错误主题(模块)名称
data any -
-
错误信息中包含的数据
cause Error -
-
源错误信息,可以包含多个错误,详见SourceError
errMsg string -
-

# 参见

注意:

  • App和Web平台,actionSheet从4.52起重构为使用dialogPage实现。重构后的版本支持暗黑主题、国际化、横屏宽屏适配。

# uni.hideActionSheet() GitCodeGitHub

关闭栈顶页面操作菜单

# hideActionSheet 兼容性

Web 微信小程序 Android iOS iOS uni-app x UTS 插件 HarmonyOS
4.51 x 4.51 4.51 4.51 x

# 参见

# 通用类型

# GeneralCallbackResult

名称 类型 必备 默认值 兼容性 描述
errMsg string -
错误信息