Landscape 压屏窗
Landscape 压屏窗,用于在浮层中显示广告或说明。
# 支持平台
| App(vue) | App(nvue) | H5 | 小程序 |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ |
# 代码演示
部分示例演示,完整使用请参考文档API。
# 基础使用
通过 show 属性控制压屏窗的显示隐藏,position 属性设置关闭按钮的位置。
<wui-landscape :show="show" :position="position" @close="closePopup">
<image class="wui-hd__img" src="https://specialdisease-oss.gjwlyy.com/prileImg/1654007265934_.jpg" mode="widthFix"></image>
</wui-landscape>
# 点击遮罩可关闭
通过 show 属性控制压屏窗的显示隐藏,maskClosable 属性控制是否可点击遮罩关闭压屏窗(需要结合 @close 事件设置 show 为 false 来达到关闭压屏窗)
<wui-landscape :show="show" maskClosable @close="closePopup">
<image class="wui-hd__img" src="https://specialdisease-oss.gjwlyy.com/prileImg/1654007265934_.jpg" mode="widthFix"></image>
</wui-landscape>
const show = ref<any>(false);
const position = ref<any>(3);
const closePopup = () => {
show.value = false;
};
# Slots
| 插槽名称 | 说明 |
|---|---|
| default | 压屏窗显示内容 |
# Props
| 属性名 | 类型 | 说明 | 默认值 | 平台差异说明 |
|---|---|---|---|---|
| show | Boolean | 是否显示压屏窗 | false | - |
| closable | Boolean | 是否显示关闭按钮 | true | - |
| type | String | 关闭按钮icon类型:可选值cancel/clear等,具体参考 icon组件 (opens new window) | true | - |
| color | String | 关闭按钮icon颜色 | #fff | - |
| size | Number, String | 关闭按钮icon大小,单位px | 28 | - |
| position | Number, String | 关闭按钮icon位置,可选值:1-左上、2-右上、3-中下 | 3 | - |
| distance | Number, String | 关闭按钮icon与内容的距离,单位rpx | 120 | - |
| absolute | Boolean | 是否为绝对定位,为true时父级样式需要将position设置为非static值 | false | - |
| maskClosable | Boolean | 点击遮罩是否可关闭压屏窗(设为true时,需结合@close事件,通过设置show为false关闭压屏窗) | false | - |
| maskBackground | String | 遮罩背景色 | rgba(0,0,0,.6) | - |
| zIndex | Number | 压屏窗z-index值 | 1001 | Nvue端不支持,默认越靠后的元素层级越高,即将组件放置最底部 |
| param | Number, String | 自定义参数,@close事件中回传 | 0 | - |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| @close | 点击遮罩层(maskClosable=true)或关闭按钮时触发 | { param:自定义参数 } |