Skip to content

引入组件 ​

局部引入

ts
// parent.vue
const FLandscape = defineAsyncComponent(() => import('@/components/formaui/f-landscape/f-landscape.vue'))

基础用法 ​

通过 v-model 控制显示隐藏,position 控制关闭图标位置,closeOnClickMask 控制点击遮罩是否关闭。

html
<f-landscape
  v-model="show"
  :position="position"
  :close-on-click-mask="closeOnClickMask"
  :is-close-icon="isCloseIcon"
  icon-left="50rpx"
  icon-right="50rpx"
  params="invite"
  @close="onClose">
  <image src="/static/images/img_invite_3x.png" mode="widthFix" style="width: 600rpx" />
</f-landscape>
<f-button width="100%" @click="show = true">打开压屏窗</f-button>
ts
import { ref } from 'vue'
import type { FLandscapeCloseDetail, FLandscapeIconPosition } from '@/components/formaui/f-landscape/types'

const show = ref(false)
const position = ref<FLandscapeIconPosition>('bottom')
const closeOnClickMask = ref(true)
const isCloseIcon = ref(true)

const onClose = (detail: FLandscapeCloseDetail) => {
  uni.showToast({ title: `close: ${detail.params}`, icon: 'none' })
}

position属性:关闭图标位置(默认bottom)

可传入:bottom、top-right、top-left

html
<f-landscape v-model="show" position="top-right">
  <image src="/static/images/img_invite_3x.png" mode="widthFix" style="width: 600rpx" />
</f-landscape>

closeOnClickMask属性:是否点击遮罩关闭(默认true)

html
<f-landscape v-model="show" :close-on-click-mask="false">
  <image src="/static/images/img_invite_3x.png" mode="widthFix" style="width: 600rpx" />
</f-landscape>

插槽 ​

名称说明
default压屏窗展示内容

属性 ​

名称类型说明默认值
v-modelboolean是否显示压屏窗-
zIndexnumber内容区 z-index1001
isCloseIconboolean是否显示关闭图标true
iconColorstring关闭图标颜色#ffffff
iconSizenumber / string关闭图标大小25
iconUnitstring关闭图标单位,可传入[px、rpx]px
positionstring关闭图标位置,可传入[bottom、top-right、top-left]bottom
iconTopstring关闭图标 top,position 为顶部时生效-120rpx
iconBottomstring关闭图标 bottom,position 为 bottom 时生效-120rpx
iconLeftstring关闭图标 left,position 为 top-left 时生效0
iconRightstring关闭图标 right,position 为 top-right 时生效0
closeOnClickMaskboolean是否点击遮罩关闭true
isMaskboolean是否显示遮罩true
maskBgColorstring遮罩背景色rgba(0, 0, 0, 0.6)
maskZIndexnumber遮罩 z-index1000
paramsnumber / string关闭回调自定义参数,随 close 带回0

事件 ​

事件名说明回调参数
close关闭时触发(图标或遮罩){ params }

方法 ​

方法名说明传入参数
---