This commit is contained in:
gexinzhineng/gxzn27 2023-05-31 17:28:22 +08:00
parent 124213bb4c
commit 38fa336816
2 changed files with 19 additions and 22 deletions

View File

@ -129,15 +129,6 @@ const handleFiles = (datas: CodegenPreviewVO[]) => {
} }
/** 复制 **/ /** 复制 **/
const copy = async (text: string) => { const copy = async (text: string) => {
let url = text
let oInput = document.createElement('textarea')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // ;
// console.log(oInput.value)
document.execCommand('Copy') //
message.success('复制成功')
oInput.remove()
// const { copy, copied, isSupported } = useClipboard({ source: text }) // const { copy, copied, isSupported } = useClipboard({ source: text })
// if (!isSupported.value) { // if (!isSupported.value) {
// message.error(t('common.copyError')) // message.error(t('common.copyError'))
@ -147,6 +138,15 @@ const copy = async (text: string) => {
// message.success(t('common.copySuccess')) // message.success(t('common.copySuccess'))
// } // }
// } // }
let url = text
let oInput = document.createElement('textarea')
oInput.value = url
document.body.appendChild(oInput)
oInput.select() // ;
// console.log(oInput.value)
document.execCommand('Copy') //
message.success(t('common.copySuccess'))
oInput.remove()
} }
defineExpose({ defineExpose({
show show

View File

@ -54,8 +54,8 @@
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:on-error="excelUploadError" :on-error="excelUploadError"
:on-change="handleFileChange"
:before-remove="beforeRemove" :before-remove="beforeRemove"
:on-change="handleFileChange"
:auto-upload="false" :auto-upload="false"
accept=".jpg, .png, .gif" accept=".jpg, .png, .gif"
> >
@ -168,6 +168,15 @@ const uploadDialog = () => {
} }
// ========== ========== // ========== ==========
const handleCopy = async (text: string) => { const handleCopy = async (text: string) => {
// const { copy, copied, isSupported } = useClipboard({ source: text, read: true })
// if (!isSupported.value) {
// message.error(t('common.copyError'))
// } else {
// await copy()
// if (unref(copied.value)) {
// message.success(t('common.copySuccess'))
// }
// }
let url = text let url = text
let oInput = document.createElement('textarea') let oInput = document.createElement('textarea')
oInput.value = url oInput.value = url
@ -177,17 +186,5 @@ const handleCopy = async (text: string) => {
document.execCommand('Copy') // document.execCommand('Copy') //
message.success(t('common.copySuccess')) message.success(t('common.copySuccess'))
oInput.remove() oInput.remove()
// const { copy, copied, isSupported } = useClipboard({ source: text, read: true })
// console.log(copy, 'copycopycopy')
// console.log(copied, 'copiedcopiedcopied')
// console.log(isSupported, 'isSupportedisSupportedisSupported')
// if (!isSupported.value) {
// message.error(t('common.copyError'))
// } else {
// await copy()
// if (unref(copied.value)) {
// message.success(t('common.copySuccess'))
// }
// }
} }
</script> </script>