Merge pull request #679 from kingxjs/main
Some checks failed
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled
Some checks failed
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled
fix: use document to build input fix copy command
This commit is contained in:
commit
cdf837bf11
@ -49,8 +49,18 @@ export async function copy(text) {
|
|||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(text);
|
await navigator.clipboard.writeText(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
okay = false;
|
try {
|
||||||
console.error(e);
|
// 构建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;
|
return okay;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user