更新记录
1.0.0.1(2025-12-26)
下载此版本
更新uview-plus
1.0.0(2025-12-26)
下载此版本
master
平台兼容性
uni-app(4.13)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
√ |
√ |
√ |
- |
√ |
√ |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
安装
在市场导入xf-popupuni_modules版本的即可,无需import
组件关联说明
代码演示
插件使用
- 位于 uni_modules/xf-popup/components/xf-popup
- 导入插件后需通过插槽自定义内容
<xf-popup>
<view class="xf-col" style="height: 300px;">
<text>自定义选项内容</text>
</view>
</xf-popup>
基本用法
-
使用组件代码如下:
<template>
<view class="xf-col" >
<xf-button style="margin-top: 20px;" round type="primary" text="打开基础弹窗" @click="showPopup('none')" />
<xf-button style="margin-top: 20px;" round type="primary" text="打开单按钮弹窗" @click="showPopup('single')" />
<xf-button style="margin-top: 20px;" round type="primary" text="打开双按钮弹窗" @click="showPopup('both')" />
</view>
<xf-popup v-model:show="showBasicModal" :type="popupType" tip="副标题">
<view class="xf-col" style="height: 300px;">
<text>这是弹窗的内容区域,可以放置任何内容。</text>
</view>
<template #footerBtn>
<view style="margin-right: 20px;">
<xf-button type="image" iconName="edit" :iconSize='26'/>
</view>
</template>
</xf-popup>
</template>
-
基础用法说明:属性type可选值none/single/both对应表示底部按钮数量,插槽footerBtn,必须single/both生效,自定义底部按钮右边选项内容;
<script setup lang="ts">
import { ref } from 'vue';
let showBasicModal = ref(false)
let popupType = ref<String>("none")
function showPopup(type : String) {
popupType.value = type
showBasicModal.value = true
}
</script>
API
Props
| 属性名 |
说明 |
类型 |
默认值 |
| v-model:show |
是否展示弹窗 |
boolean |
false |
| title |
弹出层标题 |
string |
标题 |
| tip |
弹出层副标题 |
string |
- |
| type |
类型底部按钮数量 |
none|single|both |
none |
| leftBtnText |
左边按钮名称 |
string |
取消 |
| rightBtnText |
右边按钮名称 |
string |
确认 |
| closeOnClickOverlay |
点击遮罩是否关闭弹窗 |
boolean |
true |
| position |
弹出层方向方向 |
top|bottom|left|right|center |
bottom |
事件 Emits
| 事件名 |
说明 |
返回值 |
| open |
打开弹出层事件 |
|
| closed |
关闭弹出层事/点击取消按钮 |
|
| confirm |
点击右边确认按钮事件 |
|
插槽 slot
| 名称 |
说明 |
|
中间自定义内容 |
| footerBtn |
type为single/both生效,自定义底部按钮右边选项内容 |
| bottom |
弹出层最底部自定义内容 |