Skip to content

Commit 1c7690b

Browse files
committed
refactor(Debug.vue): integrate fullscreen functionality using @vueuse/core and clean up unused fullscreen logic
1 parent 00d723e commit 1c7690b

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

  • packages/business/src/views/data-server

packages/business/src/views/data-server/Debug.vue

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import VCodeEditor from '@tap/component/src/base/VCodeEditor.vue'
66
import { IconButton } from '@tap/component/src/icon-button'
77
import { useI18n } from '@tap/i18n'
88
import { copyToClipboard } from '@tap/shared/src/util'
9-
import { useDark } from '@vueuse/core'
9+
import { useDark, useFullscreen } from '@vueuse/core'
1010
import {
1111
computed,
1212
inject,
@@ -46,11 +46,13 @@ const debugHttpInfo = ref<Record<string, any>>({})
4646
const templates = ref<Record<string, string>>({})
4747
const intervalId = ref()
4848
const loading = ref(false)
49-
const isFullscreen = ref(false)
49+
// const isFullscreen = ref(false)
5050
const resultRef = ref<HTMLElement | null>(null)
5151
const titleRef = ref<HTMLElement | null>(null)
5252
const jsonPrettyHeight = ref(280)
5353
54+
const { isFullscreen, toggle: toggleFullscreen } = useFullscreen(resultRef)
55+
5456
const 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-
292278
const handleCopy = () => {
293279
copyToClipboard(JSON.stringify(debugResult.value, null, 2))
294280
ElMessage.success(t('public_message_copy_success'))

0 commit comments

Comments
 (0)