Compare commits
No commits in common. "83c61e9c424d7f1414090ace82c4f023c2e31a10" and "0f0f8aaeef34a06567a0dd88141a9c22e913ed46" have entirely different histories.
83c61e9c42
...
0f0f8aaeef
|
@ -94,31 +94,40 @@ const AppGeneratorPage = defineComponent({
|
||||||
* 点击复制图表
|
* 点击复制图表
|
||||||
* 几秒后恢复原状
|
* 几秒后恢复原状
|
||||||
*/
|
*/
|
||||||
async onCopyToClipboard(code) {
|
onCopyToClipboard(code) {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = code;
|
||||||
|
// 避免滚动到页面底部
|
||||||
|
textarea.style.position = 'fixed';
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(code);
|
const successful = document.execCommand('copy');
|
||||||
antd.notification.open({
|
if (successful) {
|
||||||
type: 'success',
|
this.copied = true;
|
||||||
message: '复制成功',
|
antd.notification.open({
|
||||||
description: '已将内容复制至剪切板',
|
type: 'success',
|
||||||
duration: 3,
|
message: '复制成功',
|
||||||
});
|
description: '已将内容复制至剪切板',
|
||||||
|
duration: 3,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 几秒后恢复原状
|
||||||
|
setTimeout(() => {
|
||||||
|
this.copied = false;
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
antd.notification.open({
|
antd.notification.open({
|
||||||
type: 'error',
|
type: 'success',
|
||||||
message: '复制失败',
|
message: '复制失败',
|
||||||
description: err.message``,
|
description: err.message,
|
||||||
duration: 3,
|
duration: 3,
|
||||||
});
|
});
|
||||||
console.error('复制失败:', err);
|
|
||||||
// 回退到传统方法
|
|
||||||
const textarea = document.createElement('textarea');
|
|
||||||
textarea.value = code;
|
|
||||||
document.body.appendChild(textarea);
|
|
||||||
textarea.select();
|
|
||||||
document.execCommand('copy');
|
|
||||||
document.body.removeChild(textarea);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.body.removeChild(textarea);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 下载全部文件 */
|
/* 下载全部文件 */
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
handler(val) {
|
handler(val) {
|
||||||
this.tableList = this.rawTableList;
|
this.tableList = this.rawTableList;
|
||||||
// 根据表名进行过滤筛选或者根据注释内容进行筛选
|
// 根据表名进行过滤筛选或者根据注释内容进行筛选
|
||||||
this.tableList = this.tableList.filter(table => table.tableName.includes(val) || table.comment.includes(val));
|
this.tableList = this.tableList.filter(table => table.tableName.includes(val) || table.tablePrefixes.includes(val));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue