Skip to content

Commit

Permalink
fix:全屏使用DOM控制
Browse files Browse the repository at this point in the history
  • Loading branch information
houdunwang committed Jun 25, 2023
1 parent 289f29f commit da66438
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/renderer/src/components/FullScreen.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<script setup lang="ts">
import { FullScreen } from '@icon-park/vue-next'
import useCamera from '@renderer/composables/useCamera'
const { toggleFullscreen } = useCamera()
// import useCamera from '@renderer/composables/useCamera'
import { ref } from 'vue'
// const { toggleFullscreen } = useCamera()
const isFullScreen = ref<boolean>(false)
const toggleFullScreen = () => {
isFullScreen.value ? document.exitFullscreen() : document.documentElement.requestFullscreen()
isFullScreen.value = !isFullScreen.value
}
document.addEventListener('fullscreenchange', (e) => {
isFullScreen.value = Boolean(document.fullscreenElement)
})
</script>

<template>
Expand All @@ -11,7 +22,7 @@ const { toggleFullscreen } = useCamera()
fill="#ffffff"
class="icon"
:strokeWidth="5"
@click="toggleFullscreen"
@click="toggleFullScreen"
/>
</template>

Expand Down

0 comments on commit da66438

Please sign in to comment.