Landscape 压屏窗 
概述
Landscape 压屏窗,用于在浮层中显示广告或说明。
# 支持平台
| App-vue | App-Nvue | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 | H5 | PC | 快手小程序 | 钉钉小程序 |
|---|---|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
温馨提示
一般来说我们会通过 z-index + position 来进行层级的设置,但是 weex (Nvue)不支持 z-index 设置层级关系,默认越靠后的元素层级越高。
App端如果需要覆盖原生导航栏以及tabbar请使用 subNVue 原生子窗体 (opens new window) 方案。
# 引入
以下介绍两种常用的引入方式。
第一种:在页面中引用、注册
import fuiLandscape from "@/components/firstui/fui-landscape/fui-landscape.vue"
export default {
components:{
fuiLandscape
}
}
1
2
3
4
5
6
2
3
4
5
6
第二种:easycom组件规范
传统vue组件,需要安装、引用、注册,三个步骤后才能使用组件。easycom将其精简为一步。
First UI easycom配置请查看 快速上手。
如果不了解easycom,可先查看 官网文档 (opens new window)。
# 代码演示
部分示例演示,完整使用请参考示例程序以及文档API。
基础使用
通过 show 属性控制压屏窗的显示隐藏,position 属性设置关闭按钮的位置。
<fui-landscape :show="show" :position="position" @close="closePopup">
<image class="fui-hd__img" src="/static/images/member/light/img_layer_3x.png" mode="widthFix"></image>
</fui-landscape>
1
2
3
2
3
点击遮罩可关闭
通过 show 属性控制压屏窗的显示隐藏,maskClosable 属性控制是否可点击遮罩关闭压屏窗(需要结合 @close 事件设置 show 为false来达到关闭压屏窗)。
<fui-landscape :show="show" maskClosable @close="closePopup">
<image class="fui-hd__img" src="/static/images/member/light/img_layer_3x.png" mode="widthFix"></image>
</fui-landscape>
1
2
3
2
3
# 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 V1.7.0+ | Boolean | 是否为绝对定位,为true时父级样式需要将position设置为非static值 | false | - |
| maskClosable | Boolean | 点击遮罩是否可关闭压屏窗(设为true时,需结合@close事件,通过设置show为false关闭压屏窗) | false | - |
| maskBackground | String | 遮罩背景色 | rgba(0,0,0,.6) | - |
| zIndex | Number | 压屏窗z-index值 | 996 | Nvue端不支持,默认越靠后的元素层级越高,即将组件放置最底部 |
| param | Number, String | 自定义参数,@close事件中回传 | 0 | - |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| @close | 点击遮罩层(maskClosable=true)或关闭按钮时触发 | { param:自定义参数 } |
示例预览
# 示例代码地址
# 特别说明
← Gallery 画廊 Loading 加载 →