<script lang="ts" setup>
|
import { Icon } from '@/components/Icon'
|
import { useFullscreen } from '@vueuse/core'
|
import { propTypes } from '@/utils/propTypes'
|
import { useDesign } from '@/hooks/web/useDesign'
|
|
defineOptions({ name: 'ScreenFull' })
|
|
const { getPrefixCls } = useDesign()
|
|
const prefixCls = getPrefixCls('screenfull')
|
|
defineProps({
|
color: propTypes.string.def('')
|
})
|
|
const { toggle, isFullscreen } = useFullscreen()
|
|
const toggleFullscreen = () => {
|
toggle()
|
}
|
</script>
|
|
<template>
|
<div :class="prefixCls" @click="toggleFullscreen">
|
<Icon
|
:color="color"
|
:icon="isFullscreen ? 'zmdi:fullscreen-exit' : 'zmdi:fullscreen'"
|
:size="18"
|
/>
|
</div>
|
</template>
|