更新记录

1.0.0(2025-08-01)

  • 【初始化】支持安卓,iOS,Web端
  • 【新增】支持高度自定义

平台兼容性

uni-app x(4.66)

Chrome Chrome插件版本 Safari Safari插件版本 Android Android插件版本 iOS iOS插件版本 鸿蒙 微信小程序
1.0.0 1.0.0 5.0 1.0.0 12 1.0.0 - -

Turbo UI 系列插件 - 模态框

  • 如您已购买Turbo UI,那么该插件可以免费使用源码版!
  • 使用需要打自定义基座,最新支持4.71,4.66,4.63,4.72版本,其他自测
  • 高度支持自定义,无需第三方库,纯手绘制

使用示例

<script setup lang="uts">
    import * as TModal from '@/uni_modules/t-modal-api'

    const showMyModal = () => {
      TModal.showModal({
        title: '提示',
        content: 'Turbo UI Modal',
        confirmText: '确定',
        cancelText: '取消',
        showCancel: true,
        animationDuration: 300,
            success: (result: TModal.TModalResult) => {
                console.log(result)
            },
            fail: (result: TModal.TModalResult) => {
                console.log(result)
            }
      } as TModal.TModalOptions)
    }
</script>

暴露的类型

export type TModalResult = {
  /**
   * 是否确认
   */
  confirm: boolean
  /**
   * 是否取消
   */
  cancel: boolean
}

export type TModalOptions = {
  /**
   * 标题
   */
  title?: string;
  /**
   * 内容
   */
  content: string;
  /**
   * 确认按钮文本
   */
  confirmText?: string;
  /**
   * 取消按钮文本
   */
  cancelText?: string;
  /**
   * 是否显示取消按钮
   */
  showCancel?: boolean;
  /**
   * 动画持续时间(毫秒)
   */
  animationDuration?: number;
  /**
   * 弹窗 宽度
   */
  width?: number;
  /**
   * 弹窗 高度
   */
  height?: number;
    /**
     * 按钮圆角
     */
    btnRadius?: number;
    /**
     * 弹窗圆角
     */
    radius?: number;
    /**
     * 取消按钮背景颜色
     */
    cancelBgColor?: string;
    /**
     * 取消按钮文字颜色
     */
    cancelTextColor?: string;
    /**
     * 确认按钮背景颜色
     */
    confirmBgColor?: string;
    /**
     * 确认按钮文字颜色
     */
    confirmTextColor?: string;
    /**
     * 确认按钮宽度(如showCancel = false,那么该值无效)
     */
    confirmWidth?: number;
    /**
     * 确认按钮高度
     */
    confirmHeight?: number;
    /**
     * 取消按钮宽度
     */
    cancelWidth?: number;
    /**
     * 取消按钮高度
     */
    cancelHeight?: number;
    /**
     * 背景颜色
     */
    bgColor?: string;
    /**
     * 内容高度
     */
    contentHeight?: number;
    success?: (result:TModalResult) => void;
    fail?: (result:TModalResult) => void;
}

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。