Skip to content

x-actionsheet-s 底部动作菜单

从底部弹出的原生动作菜单,用来替代 uni.showActionSheet 的样式受限场景。视觉对齐 tmx-ui 的 x-action-menu:灰底白条、遮罩淡入、内容从底向上滑出,并预留底部安全区。

微信内使用官方 uni.showActionSheet,图标、圆角、遮罩色等样式字段不生效,仅保留签名。

兼容性

HarmonyIOSAndroidWEB小程序
支持支持支持支持支持(官方菜单)

调用

ts
import { showActionSheet, hideActionSheet, XActionSheetOptions, XActionSheetItem } from "@/uni_modules/x-actionsheet-s"

showActionSheet({
  title: "请选择操作",
  list: [
    { id: "share", text: "分享", icon: "F0FD" } as XActionSheetItem,
    { id: "edit", text: "编辑", icon: "EC86" } as XActionSheetItem,
    { id: "del", text: "删除", icon: "EC2A", fontColor: "#e54d42" } as XActionSheetItem
  ] as XActionSheetItem[],
  itemClick: (index : number, item : XActionSheetItem) => {
    console.log("点击", index, item.text)
  },
  cancel: () => {
    console.log("取消 / 遮罩 / 手势返回")
  },
  close: () => {
    console.log("已关闭")
  }
} as XActionSheetOptions)

主动关闭:

ts
hideActionSheet()

参数

XActionSheetItem

字段说明默认
id条目标识索引字符串
text条目文字必填
iconRemix 图标 unicode,如 F0FD。微信不支持""
iconColor图标颜色#333333
fontColor文字颜色#333333
fontSize字号 px16
disabled禁用false

XActionSheetOptions

字段说明默认
title标题请选择
showTitle是否显示标题true
list条目数组[]
showCancel是否显示取消true
cancelText取消文字取消
cancelColor取消文字色#333333
overlayClick点击遮罩关闭true
cellClickClose点击条目后关闭true
space非通栏:相对屏幕左右和底部留间隙(不是内容 padding),四角圆角;false 为通栏贴边true
round圆角 px16
maxHeight列表最大高度 px,0 为屏高 80%0
maskBgColor遮罩色rgba(0,0,0,0.35)
contentBgColor面板底色#f5f5f5
cellBgColor条目底色#ffffff
titleColor标题色#888888
duration动画 ms350
itemClick点击条目-
cancel取消 / 遮罩 / 手势返回-
close关闭完成-

平台差异

  1. 微信小程序:uni.showActionSheet,最多 6 条,仅 title(alertText)、textfontColor(itemColor)生效;hideActionSheet 为空实现。

版本

版权归https://xui.tmui.design你不得修改及二次开发,仅供TMUI4会员商用使用。不得转给非VIP会员使用,一经查实数倍赔偿,并追究法律责任。

更新日志

1.0.2(2026-09-08)

  • 蒸汽 Android:关闭动画 alpha 不再把 toFloat() 赋给中间变量,避免编成 Kotlin Number 传给只要 Float 的 API。

1.0.1(2026-08-14)

  • App 三端复制独立字体 x-actionsheet-remixicon.ttf(族名同步改名),避免和其它插件的 remixicon.ttf 资源冲突。
  • Web 图标字体族名为 x-actionsheet-remixicon,文件使用全局 /static/tmui4xLibs/static/remixicon.ttf

1.0.0(2026-08-14)

  • 新增 x-actionsheet-s:App 三端原生全屏弹层,遮罩淡入、内容从底向上弹出,支持手势返回关闭并预留底部安全区。
  • Web 使用自定义 div 节点实现;微信小程序走官方 showActionSheet,不支持的样式字段保留签名。
最近更新