🐛 修复前端复制按钮bug;

This commit is contained in:
Bunny 2025-07-04 12:32:38 +08:00
parent 2b3cddca52
commit 25c8e27e9b
1 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,8 @@ const AppGeneratorPage = defineComponent({
* 几秒后恢复原状 * 几秒后恢复原状
*/ */
async onCopyToClipboard(code) { async onCopyToClipboard(code) {
this.copied = true;
try { try {
await navigator.clipboard.writeText(code); await navigator.clipboard.writeText(code);
antd.notification.open({ antd.notification.open({
@ -119,6 +121,13 @@ const AppGeneratorPage = defineComponent({
document.execCommand('copy'); document.execCommand('copy');
document.body.removeChild(textarea); document.body.removeChild(textarea);
} }
// 显示已复制图标时长
if (this.copied) {
setTimeout(() => {
this.copied = false;
}, 2000)
}
}, },
/* 下载全部文件 */ /* 下载全部文件 */