Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cdf837bf
authored
Dec 30, 2024
by
Calcium-Ion
Committed by
GitHub
Dec 30, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #679 from kingxjs/main
fix: use document to build input fix copy command
parents
d5757390
e266bc91
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
web/src/helpers/utils.js
+12
-2
No files found.
web/src/helpers/utils.js
View file @
cdf837bf
...
...
@@ -49,8 +49,18 @@ export async function copy(text) {
try
{
await
navigator
.
clipboard
.
writeText
(
text
);
}
catch
(
e
)
{
okay
=
false
;
console
.
error
(
e
);
try
{
// 构建input 执行 复制命令
var
_input
=
window
.
document
.
createElement
(
"input"
);
_input
.
value
=
text
;
window
.
document
.
body
.
appendChild
(
_input
);
_input
.
select
();
window
.
document
.
execCommand
(
"Copy"
);
window
.
document
.
body
.
removeChild
(
_input
);
}
catch
(
e
)
{
okay
=
false
;
console
.
error
(
e
);
}
}
return
okay
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment