更新记录

1.0.0(2024-05-26) 下载此版本

初次上传


平台兼容性

uni-app

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
× √ √ √ √ - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
√ - - - - - - - - - - -

其他

多语言 暗黑模式 宽屏模式 蒸汽模式
× × √ ×

shmilyr-popup 可手势关闭弹窗

参数说明

字段 类型 必填 默认值 描述
modelValue Boolean 否 false 是否显示
contentCustomStyle Object 否 {} 内容区域样式
overlayCustomStyle Object 否 {} 蒙版区域样式
overlayBackground String 否 rgb(0 0 0 / .6) 遮罩层背景
contentBackground String 否 rgb(255 255 255 / 1) 内容区域背景颜色
blur Number 否 0 蒙版模糊深度(单位rpx)
placement Enum 否 center 内容显示位置['bottom', 'left', 'right', 'top', 'center']
duration Number 否 200 过渡时长(单位ms), 不想要过渡可把时长设为0
safeAreaBottom Boolean 否 false 开启底部安全距离
safeAreaTop Boolean 否 false 开启顶部安全距离
radius Number 否 40 圆角(单位rpx)
contentPadding Number 否 40 内容区域内边距(单位rpx)
enableGesture Boolean 否 true 是否可以手势关闭
closeOnClickOverlay Boolean 否 true 是否可点击蒙版关闭
modal Boolean 否 false 是否显示为模态框类型(placement需要传center或不传)
modalTitle String 否 标题 模态框标题
modalContent String 否 消息提示模态框 模态框主题内容
modalCancelText String 否 取消 模态框取消文字
modalConfirmText String 否 确认 模态框确认文字
modalCancelColor String 否 #B1B7C6 模态框取消按钮暗色
modalConfirmColor String 否 #FED309 模态框确认按钮颜色
modalTitleStyle Object 否 {} 模态框头部样式
modalContentStyle Object 否 {} 模态框内容样式
modalWidth String 否 70vw 模态框宽度
modalMaxWidth String 否 600rpx 模态框最大宽
modalHeader Boolean 否 true 是否显示模态框头部
modalFooter Boolean 否 true 是否显示模态框底部
modalFooterBorder Boolean 否 true 是否显示模态框底部边框
modalFooterBorderColor String 否 #F2F2F2 模态框底部边框颜色
modalCancelButton Boolean 否 true 是否显示取消按钮
modalConfirmButton Boolean 否 true 是否显示确认按钮

插槽

名称 说明
default 默认插槽, 传入时若modal设置为true, 不会显示默认的模态框样式
modal-title 模态框标题
modal-content 模态框内容
modal-footer 模态框底部按钮区域, 可用于自定义按钮

事件

事件名 说明 回调参数
open 显示回调 --
close 关闭回调 --
cancel 模态框取消按钮点击回调 --
confirm 模态框确认按钮点击回调 --

使用示例

<template>
  <view>
    <button type="button" @click="visible1 = true">底部可手势弹窗</button>
    <button type="button" @click="visible2 = true">左侧可手势弹窗</button>
    <button type="button" @click="visible3 = true">顶部可手势弹窗</button>
    <button type="button" @click="visible4 = true">右侧可手势弹窗</button>
    <button type="button" @click="visible5 = true">模糊背景弹窗</button>
    <button type="button" @click="visible6 = true">不可使用手势关闭弹窗</button>
    <button type="button" @click="visible7 = true">中间弹窗</button>
    <button type="button" @click="visible8 = true">模态框</button>
    <button type="button" @click="visible9 = true">模态框自定义按钮</button>
    <button type="button" @click="visible10 = true">无取消按钮</button>
    <!-- Pupup Example -->
    <shmilyr-popup
      v-model="visible1"
      placement="bottom"
    >
      <view style="height: 60vh;">底部可手势弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible2"
      placement="left"
    >
      <view style="width: 40vw;">左侧可手势弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible3"
      placement="top"
    >
      <view style="height: 60vh;">顶部可手势弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible4"
      placement="right"
    >
      <view style="width: 40vw;">右侧可手势弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible7"
      placement="center"
    >
      <view style="width: 70vw;height:300rpx;">中间弹窗(中间弹窗时不可使用手势关闭)</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible5"
      placement="bottom"
      :blur="5"
    >
      <view style="height: 60vh;">模糊背景弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible6"
      placement="bottom"
      :enable-gesture="false"
    >
      <view style="height: 60vh;">不可使用手势关闭弹窗</view>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible8"
      placement="center"
      modal
      title="弹窗标题"
      content="消息提示模态框"
      modalCancelText="取消"
      modalConfirmText="确认"
      modalCancelColor="#B1B7C6"
      modalConfirmColor="#FED309"
      modalWidth="70vw"
    >
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible9"
      placement="center"
      modal
      content="自定义按钮"
    >
      <template #modal-footer>
        <view style="padding: 20rpx;width: 100%;">
          <button type="primary" style="border-radius: 100rpx;" @click="visible9 = false">确认</button>
        </view>
      </template>
    </shmilyr-popup>
    <shmilyr-popup
      v-model="visible10"
      placement="center"
      modal
      content="无取消按钮"
      :modal-cancel-button="false"
    ></shmilyr-popup>
  </view>
</template>

<script>
export default {
  data() {
    return {
      visible1: false,
      visible2: false,
      visible3: false,
      visible4: false,
      visible5: false,
      visible6: false,
      visible7: false,
      visible8: false,
      visible9: false,
      visible10: false,
    }
  }
}
</script>

隐私、权限声明

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

无

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

无

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

无

许可协议

MIT协议