feat: code copy
This commit is contained in:
parent
89ce21acfe
commit
48c271c9d5
@ -11,6 +11,7 @@ import {
|
|||||||
} from '@vben/common-ui';
|
} from '@vben/common-ui';
|
||||||
import { Icon } from '@vben/icons';
|
import { Icon } from '@vben/icons';
|
||||||
|
|
||||||
|
import { useClipboard } from '@vueuse/core';
|
||||||
import { Skeleton, Tree } from 'ant-design-vue';
|
import { Skeleton, Tree } from 'ant-design-vue';
|
||||||
|
|
||||||
import { previewCode } from '#/api/tool/gen';
|
import { previewCode } from '#/api/tool/gen';
|
||||||
@ -148,6 +149,8 @@ function handleClose() {
|
|||||||
modalTitle.value = '代码预览';
|
modalTitle.value = '代码预览';
|
||||||
language.value = 'html';
|
language.value = 'html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { copy } = useClipboard({ legacy: true });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -181,6 +184,9 @@ function handleClose() {
|
|||||||
class="h-[calc(100vh-80px)] w-full overflow-y-scroll text-[16px]"
|
class="h-[calc(100vh-80px)] w-full overflow-y-scroll text-[16px]"
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
|
<div class="fixed right-20 top-20">
|
||||||
|
<a-button @click="copy(codeContent)">复制</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Skeleton v-if="!currentCodeData" active />
|
<Skeleton v-if="!currentCodeData" active />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
|
Loading…
Reference in New Issue
Block a user