|
|
3 anni fa | |
|---|---|---|
| .. | ||
| config.json | 3 anni fa | |
| readme.md | 3 anni fa | |
| uni-popup.vue | 3 anni fa | |
弹出层组件,为了解决遮罩弹层的问题。组件名:uni-popup,代码块: uPopup。
使用方式:
在 script 中引用组件
import uniPopup from "@/components/uni-popup/uni-popup.vue"
export default {
components: {uniPopup}
}
基本用法
<uni-popup ref="popup" type="bottom">底部弹出 Popup</uni-popup>
属性说明:
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| animation | Boolean | true | 是否开启动画 |
| type | String | center | 弹出方式,可选值:top(顶部),center(居中),bottom(底部) |
| show | Boolean | false | 显示弹窗 |
| custom | Boolean | false | 是否自定义内容 |
| maskClick | Boolean | true | 蒙版点击是否关闭弹窗 |
方法说明:
通过 ref 获取组件方法
| 事件称名 | 说明 |
|---|---|
| open | 打开弹出层 |
| close | 关闭弹出层 |
<view>
<button @click="openPopup">打开弹出层</button>
<uni-popup ref="popup" type="center">
弹出层示例
<button @click="closePopup">关闭弹出层</button>
</uni-popup>
</view>
export default {
methods:{
openPopup(){
this.$refs.popup.open()
},
closePopup(){
this.$refs.popup.close()
}
}
}
Tips
1.1.2
1.1.1
1.1.0
1.0.0