|
@@ -169,6 +169,7 @@ import {
|
|
|
closeAuthority
|
|
|
} from "@/api/system/secret";
|
|
|
import {listAllProject} from "@/api/system/project";
|
|
|
+import Clipboard from 'clipboard';
|
|
|
|
|
|
export default {
|
|
|
name: "secret",
|
|
@@ -341,15 +342,23 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 复制授权码按钮操作 */
|
|
|
- handleCopy(row) {
|
|
|
- const secretKey = row.secretKey;
|
|
|
- navigator.clipboard.writeText(secretKey)
|
|
|
- .then(() => {
|
|
|
- this.$message.success("信息已复制");
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.error("复制授权码操作失败: ", err);
|
|
|
- });
|
|
|
+ handleCopy(e) {
|
|
|
+ const r = e.secretKey;
|
|
|
+ const clipboard = new Clipboard('.copy-button', {
|
|
|
+ text: () => r,
|
|
|
+ });
|
|
|
+
|
|
|
+ clipboard.on('success', () => {
|
|
|
+ this.$message.success('信息已复制');
|
|
|
+ clipboard.destroy();
|
|
|
+ });
|
|
|
+
|
|
|
+ clipboard.on('error', () => {
|
|
|
+ console.error('复制授权码操作失败');
|
|
|
+ clipboard.destroy();
|
|
|
+ });
|
|
|
+
|
|
|
+ clipboard.onClick(event);
|
|
|
},
|
|
|
onChange(e) {
|
|
|
this.form.projectId = e
|