@@ -6,7 +6,7 @@ import VCodeEditor from '@tap/component/src/base/VCodeEditor.vue'
66import { IconButton } from ' @tap/component/src/icon-button'
77import { useI18n } from ' @tap/i18n'
88import { copyToClipboard } from ' @tap/shared/src/util'
9- import { useDark } from ' @vueuse/core'
9+ import { useDark , useFullscreen } from ' @vueuse/core'
1010import {
1111 computed ,
1212 inject ,
@@ -46,11 +46,13 @@ const debugHttpInfo = ref<Record<string, any>>({})
4646const templates = ref <Record <string , string >>({})
4747const intervalId = ref ()
4848const loading = ref (false )
49- const isFullscreen = ref (false )
49+ // const isFullscreen = ref(false)
5050const resultRef = ref <HTMLElement | null >(null )
5151const titleRef = ref <HTMLElement | null >(null )
5252const jsonPrettyHeight = ref (280 )
5353
54+ const { isFullscreen, toggle : toggleFullscreen } = useFullscreen (resultRef )
55+
5456const urlsMap = computed (() => {
5557 return props .urlList .reduce ((acc : Record <string , string >, item ) => {
5658 acc [item .method ] = item .url + (item .last || ' ' )
@@ -273,22 +275,6 @@ function enterFullscreen(element: HTMLElement) {
273275 }
274276}
275277
276- function exitFullscreen() {
277- if (document .exitFullscreen ) {
278- document .exitFullscreen ()
279- }
280- }
281-
282- const toggleFullscreen = () => {
283- if (isFullscreen .value ) {
284- exitFullscreen ()
285- } else {
286- enterFullscreen (resultRef .value ! )
287- }
288-
289- isFullscreen .value = ! isFullscreen .value
290- }
291-
292278const handleCopy = () => {
293279 copyToClipboard (JSON .stringify (debugResult .value , null , 2 ))
294280 ElMessage .success (t (' public_message_copy_success' ))
0 commit comments