Skip to content

FullScreen

Full screen component

TIP

Please pay attention to z-index when elements are not displayed as expected.

Basic Usage

WARNING

We need to set background color, otherwise there will be large black areas.

Pass el attribute with value of HTMLElement or function type, indicating the element that needs to be full screen, default is body.

<script lang="ts" setup>
const getElement = () => {
  return document.getElementsByClassName('my-water-mark')[0]
}
</script>

<template>
  <z-full-screen :el="getElement">
    <el-button>Enter full screen</el-button>
  </z-full-screen>
  <z-watermark content="Watermark component" class="my-water-mark bg-white">
    <div class="h-500px" />
  </z-watermark>
</template>

Slots

You can use enter and exit slots to customize the entry and exit points when entering and exiting

<script lang="ts" setup>
import { ref } from 'vue'

const isFullScreen = ref(false)

const handleChange = (val) => {
  isFullScreen.value = val
}

const getElement = () => {
  return document.getElementsByClassName('my-water-mark')[1]
}
</script>

<template>
  <div class="my-water-mark bg-white">
    <z-full-screen :el="getElement" @change="handleChange">
      <template #enter>
        <el-button class="z-100">
          Enter full screen
        </el-button>
      </template>
      <template #exit>
        <el-button>
          Exit full screen
        </el-button>
      </template>
    </z-full-screen>
    <z-watermark content="Watermark component">
      <div class="h-500px" />
    </z-watermark>
  </div>
</template>

z-full-screen Attributes

AttributeDescriptionTypeDefault
elElement that needs to be full screenHTMLElement / () => HTMLElement'body'
renderEnterCustom entry() => VNode''
renderExitCustom exit() => VNode''

z-full-screen Slots

Slot NameDescription
FullScreen content
enterEntry
exitExit

z-full-screen Events

Event NameDescriptionType
changeCallback when entering and exiting(isFullScreen: boolean) => void

Released under the MIT License.