From f1215eba88589a73a71c9a19d44c11c6fb3cb42c Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Fri, 29 Mar 2024 18:50:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DuseClipboard=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/pure/navbar/index.vue | 6 +++--- .../src/views/api-test/components/condition/content.vue | 6 +++--- .../components/requestComposition/response/result.vue | 6 +++--- .../requestComposition/response/result/tiledDisplay.vue | 6 +++--- .../management/components/management/api/preview/detail.vue | 6 +++--- .../management/components/management/api/preview/index.vue | 2 +- .../management/components/management/case/caseDetail.vue | 2 +- .../src/views/api-test/management/components/moduleTree.vue | 2 +- frontend/src/views/api-test/scenario/detail/index.vue | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/pure/navbar/index.vue b/frontend/src/components/pure/navbar/index.vue index bba2bcf239..e2721a436e 100644 --- a/frontend/src/components/pure/navbar/index.vue +++ b/frontend/src/components/pure/navbar/index.vue @@ -216,10 +216,10 @@ } } - const { copy, isSupported } = useClipboard(); - async function copyVersion() { + const { copy, isSupported } = useClipboard({ legacy: true }); + function copyVersion() { if (isSupported) { - await copy(appStore.version); + copy(appStore.version); Message.success(t('common.copySuccess')); } else { Message.warning(t('common.copyNotSupport')); diff --git a/frontend/src/views/api-test/components/condition/content.vue b/frontend/src/views/api-test/components/condition/content.vue index 4790e1feaa..e03978292c 100644 --- a/frontend/src/views/api-test/components/condition/content.vue +++ b/frontend/src/views/api-test/components/condition/content.vue @@ -581,11 +581,11 @@ if (!result){ AssertionResult.setFailureMessage(msg); AssertionResult.setFailure(true); }`); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); - async function copyScriptEx() { + function copyScriptEx() { if (isSupported) { - await copy(scriptEx.value); + copy(scriptEx.value); Message.success(t('apiTestDebug.scriptExCopySuccess')); } else { Message.warning(t('apiTestDebug.copyNotSupport')); diff --git a/frontend/src/views/api-test/components/requestComposition/response/result.vue b/frontend/src/views/api-test/components/requestComposition/response/result.vue index d2db5833ee..03226de720 100644 --- a/frontend/src/views/api-test/components/requestComposition/response/result.vue +++ b/frontend/src/views/api-test/components/requestComposition/response/result.vue @@ -111,11 +111,11 @@ default: ResponseComposition.BODY, }); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); - async function copyScript() { + function copyScript() { if (isSupported) { - await copy(props.requestResult?.responseResult.body || ''); + copy(props.requestResult?.responseResult.body || ''); Message.success(t('common.copySuccess')); } else { Message.warning(t('apiTestDebug.copyNotSupport')); diff --git a/frontend/src/views/api-test/components/requestComposition/response/result/tiledDisplay.vue b/frontend/src/views/api-test/components/requestComposition/response/result/tiledDisplay.vue index cbc5eff085..cd83e36a67 100644 --- a/frontend/src/views/api-test/components/requestComposition/response/result/tiledDisplay.vue +++ b/frontend/src/views/api-test/components/requestComposition/response/result/tiledDisplay.vue @@ -91,10 +91,10 @@ expandIds.value.push(value); } } - const { copy, isSupported } = useClipboard(); - async function copyScript() { + const { copy, isSupported } = useClipboard({ legacy: true }); + function copyScript() { if (isSupported) { - await copy(props.requestResult?.responseResult.body || ''); + copy(props.requestResult?.responseResult.body || ''); Message.success(t('common.copySuccess')); } else { Message.warning(t('apiTestDebug.copyNotSupport')); diff --git a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue index 73d056c48d..cf0fc15597 100644 --- a/frontend/src/views/api-test/management/components/management/api/preview/detail.vue +++ b/frontend/src/views/api-test/management/components/management/api/preview/detail.vue @@ -367,7 +367,7 @@ }>(); const { t } = useI18n(); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); const previewDetail = ref(props.detail); const activeResponse = ref(); @@ -458,9 +458,9 @@ const activeDetailKey = ref(['request', 'response']); - async function copyScript(val: string) { + function copyScript(val: string) { if (isSupported) { - await copy(val); + copy(val); Message.success(t('common.copySuccess')); } else { Message.warning(t('apiTestDebug.copyNotSupport')); diff --git a/frontend/src/views/api-test/management/components/management/api/preview/index.vue b/frontend/src/views/api-test/management/components/management/api/preview/index.vue index c14e366539..6f1ac04bc4 100644 --- a/frontend/src/views/api-test/management/components/management/api/preview/index.vue +++ b/frontend/src/views/api-test/management/components/management/api/preview/index.vue @@ -74,7 +74,7 @@ }>(); const emit = defineEmits(['updateFollow']); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); const { t } = useI18n(); const previewDetail = ref(cloneDeep(props.detail)); diff --git a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue index 452262d347..cb8324713b 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue @@ -125,7 +125,7 @@ (e: 'deleteCase', id: string): void; }>(); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); const { t } = useI18n(); const { openModal } = useModal(); diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue index fc40f2406d..2956253501 100644 --- a/frontend/src/views/api-test/management/components/moduleTree.vue +++ b/frontend/src/views/api-test/management/components/moduleTree.vue @@ -236,7 +236,7 @@ const appStore = useAppStore(); const { t } = useI18n(); const { openModal } = useModal(); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); const moduleProtocol = ref('HTTP'); const moduleProtocolOptions = ref([]); diff --git a/frontend/src/views/api-test/scenario/detail/index.vue b/frontend/src/views/api-test/scenario/detail/index.vue index 897ee11b17..fa3866acbd 100644 --- a/frontend/src/views/api-test/scenario/detail/index.vue +++ b/frontend/src/views/api-test/scenario/detail/index.vue @@ -156,7 +156,7 @@ (e: 'updateFollow'): void; }>(); - const { copy, isSupported } = useClipboard(); + const { copy, isSupported } = useClipboard({ legacy: true }); const { t } = useI18n(); const scenario = defineModel('scenario', {