更新记录

1.0.0(2024-05-26)

初次上传


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
app-vue × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
×

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协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问